Skip to content
⌘ NSIS Forum Archive

nsWindow plugin wait

6 posts

greena23#

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#
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#
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#
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#
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..
Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.

..are viable alternatives?
Animaether#
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.