fishsauce
7th April 2007 10:22 UTC
InstallOptions2 dynamically altering field states
Hi,
I have an InstallOptions2 custom page with a set of radio buttons and a FileRequest field, and what I would like to do is to dynamically enable the FileRequest field when the last radio button is selected, and disable it when the others are selected.
Is this possible?
Thanks in advance for your help!
fishsauce
7th April 2007 21:49 UTC
Thanks for the link, I never even knew about NOTIFY until I saw that. However, I'm having problems activating and deactivating the control. I can disable it in the pre function fine, but I can't seem to set the flags in the leave function.
Do I need the HWND field in order to set the flags in the leave function? I never quite understood that from the wiki example (I think it's just too long and complicated, all the registers get confusing).
Comperio
8th April 2007 06:30 UTC
With InstallOptions, HWND is set in each field during runtime. Once you have that, you just need to use EnableWindow to disable/enable your control
So, let's say you needed to disable Field 3 in your leave function. The code to do so would be like this:
Function
Push $R0
; some other code blah blah blah...
; ...Here's the important part:
ReadIniStr $R0 "$PLUGINSDIR\Yourpage.ini" "Field 3" "HWND"
EnableWindow $R0 0
; more code, blah blah blah...
Pop $R0
FunctionEnd
If you wanted to enable the control, you'd use the same except
EnableWindow $R0 1
For a better example, you might take a look at the "TestNotify" sample in your NSIS directory under ${NSISDIR}\Examples\InstallOptions
fishsauce
8th April 2007 08:40 UTC
That was exactly what I needed. Thank you very much for your help!