Archive: How to "forget" mouse clicks (and keypresses)?


How to "forget" mouse clicks (and keypresses)?
I'm trying to create a page with (atleast) the Next button disabled. So far I have something like this sample:


Page custom nsDialogs_MakeBackup_Create

....

Function nsDialogs_MakeBackup_Create

nsDialogs::Create /NOUNLOAD 1018 ;1040
Pop $Dialog
StrCmp $Dialog error 0 +2
Abort

${NSD_CreateLabel} 10u 10u 100% 10u "Please, wait a minute while backup files are being compressed."
Pop $1

GetDlgItem $0 $HWNDPARENT 1 ; disable NEXT button
EnableWindow $0 0
GetDlgItem $0 $HWNDPARENT 2 ; disable CANCEL button
EnableWindow $0 0
GetDlgItem $0 $HWNDPARENT 3 ; disable BACK button
EnableWindow $0 0

ShowWindow $Dialog ${SW_SHOW}
System::Call 'user32.dll::UpdateWindow(i $Dialog) i .r3'

;longish process here
Sleep 5000

${NSD_SetText} $1 "Compression has finished."

FunctionEnd


The idea is just to show a user that something is going on and no need to worry. And I wanted to keep the standard NSIS page layout so banner plugins are not in my list yet. After this informational page the process should continue normally with the next page without any stops here.

The problem is that if you click any of the disabled buttons they will be remembered when the next page appears. Which is not a good thing.

Are there any nifty system::calls that would take care of unwanted messages? (I'm not very good with system::calls yet as I haven't needed them much)

Thanks in advance.

cheers..

You are blocking the UI thread, calling ShowWindow+UpdateWindow is cheating. What is this longish process? a nsis plugin call or running a external program?

Someone(Not me I hope) could write a plugin that allows you to execute a nsis function in another thread while still processing UI messages

Edit: If you are running a external program, you could probably cheat by using nsDialog timers. Have your installer generate a batch file and exec it without waiting. Something like:

@echo off
start "" /WAIT "$instdir\someapp.exe" param1 "param 2"
echo. > "$pluginsdir\done"
cls


and have the timer check if "$pluginsdir\done" exists every second or so


The idea is just to show a user that something is going on and no need to worry
I had to cope with a similar situation (i.e. avoiding problems caused by user clicking the NEXT button "too soon").

My solution was to hide the installer window and use the banner plugin to display some text. The banner text is updated every second or so to reassure the user and once the other process has completed the installer window gets shown again.

Anders:
The longish process is atm a call to MakeCAB.

nsTimers might be one solution, I'll have to keep that in my mind. I did look at them once already if I could figure out something with them, but forgot them later.

pengyou:
Banners are a solution, but I decided they will be my last resource. Unless somebody shows me a banner that looks like a normal nsis page (and follows the rules nsis uses to build them, like colours, font sizes etc). And editable with nsDialogs commands would be a nice option too ; )

Thanks for both of you for reminding me about these :) But I still hope there were some neat tricks to clear those extra messages.

cheers..