greena23
13th August 2010 11:42 UTC
nsWindow plugin wait
Hi,
I am using the nsWindows plugin to create a messagebox with a check box. However it is created then the code runs past it and continues executing the rest of the code. How do I get it to wait until a user has clicked a button?
Thanks
Netsurfer24
13th August 2010 13:12 UTC
Hi,
I am far from being an expert, but I would try the following:
Put the rest of your function to a new function. Call this function from the button click.
Gunther
Animaether
13th August 2010 17:06 UTC
and if the code handling is inside a(n NSIS) callback that always runs through and takes action automatically once reaching its end, you can first set a variable before opening the nsWindows dialog, open the nsWindows dialog, and then use a loop with a small Sleep in it (to prevent CPU pegging) that exits once that variable is unset.. which you would do from whatever should signal continuation, presumably from nsWindows.
greena23
30th August 2010 16:13 UTC
Thanks guys for the advice. Really helpful. I have a new problem that I create the window and am using a loop so it does not run on before the user responds. However now the new window becomes unresponsive to the whole installer is stuck.
Any help would be great
Animaether
30th August 2010 19:17 UTC
aah.. bugger. I wonder why that is.
Sounds like the plugin would need a recompile so that it doesn't exit immediately.
Perhaps the solutions offered here..
http://forums.winamp.com/showthread.php?t=321153
..are viable alternatives?
Animaether
2nd September 2010 07:30 UTC
Well.. poked at this some more.. doesn't seem to be behaving itself, so would indeed need a recompile for proper behavior.
There are at least two other alternatives (next to those in that thread)...
A. create another installer whose only purpose is to display a dialog with the checkbox, with different size/etc., either using nsDialogs or nsWindows, then call that from your original installer using ExecWait. Passing data back/forth would be the (minor) issue there.
B. use a MessageBox right after the ${NSW_Show} to halt code execution, hide that messagebox while you need to interact with the nsWindows window (using a timer to find it or something more sane), then close it (SendMessage + WM_CLOSE) once you're done with your nsWindows window so that code execution will then continue. This most certainly does work, but it's HACKHACKHACK type code.