Archive: Problems with MUI InstallOptions Notify


Problems with MUI InstallOptions Notify
Hi!

I would like to enable/disable two controls (a text and a droplist) of a custom page depending on a checkbox state.

I tried to put the following code in the ini file:



[Field 4]
Type=checkbox
Text=Use special settings:
Left=10
Right=-10
Top=52
Bottom=60
State=0
Flags=GROUP|NOTIFY

[Field 5]
Type=Label
Text=Choose your country
Left=15
Right=-10
Top=62
Bottom=70
State=0
Flags=NOTABSTOP

[Field 6]
Type=DROPLIST
ListItems=none|AT Austria|AU Australia|BE Belgium|BR Brazil|CA Canada|CH Switzerland|CL Chile|DE Germany|DK Denmark|ES Spain|FI Finland|FR France|GT Guatemala|IE Ireland|IL Israel|IT Italy|JP Japan|MX Mexico|MY Malaysia|NL Netherland|NO Norway|NZ New Zealand|PH Philippines|PL Poland|PT Portugal|RU Russia|SE Sweden|SG Singapore|SI Slovenia|TR Turkey|UK Great Britain|US USA
State=None
Left=15
Right=-10
Top=70
bottom=180
Flags=DISABLED

[Field 7]
Type=Label
Text=Your EMail address:
Left=15
Right=-10
Top=86
Bottom=94
Flags=NOTABSTOP

[Field 8]
Type=Text
State=
Left=15
Right=-10
Top=96
Bottom=108
Flags=DISABLED


and used the following two functions in my script:


Function SetConfigOptions

;Display the Options dialog

Push $hwnd

!insertmacro MUI_INSTALLOPTIONS_DISPLAY "config.ini"
Pop $hwnd

FunctionEnd

Function ValidateConfigOptions


ReadINIStr $0 "$PLUGINSDIR\config.ini" "Settings" "State"


StrCmp $0 0 ValidateData
StrCmp $0 4 ToggleConfig
Abort ; Return to the page


ToggleConfig:
ReadINIStr $0 "config.ini" "Field 4" "State"
GetDlgItem $1 $hwnd 1205
EnableWindow $1 $0
GetDlgItem $1 $hwnd 1207
EnableWindow $1 $0
Abort

ValidateData:
...


It gets into the ToggleConfig part but the two controls do not switch between disabled/enabled state. What am I missing?

Thank you for helping me out!

//Heiko

I found it out on my own ....

I have to use it like this


InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR\config.ini"
; In this mode InstallOptions returns the window handle so we can use it
Pop $hwnd
; Now show the dialog and wait for it to finish
InstallOptions::show


... works like a charm. I love NSIS :-)