The script creates a simple license custom page and I want to disable the Install button until the I Agree Radio button is selected otherwise it needs to stay disabled.
[Settings]
NumFields=3
[Field 1]
Type=Text
Left=10
Right=-10
Top=10
Bottom=110
State=blabla
Flags=MULTILINE|VSCROLL|READONLY
[Field 2]
Type=RadioButton
Text=I AGREE
Flags=NOTIFY
State=0
Left=10
Right=110
Top=120
Bottom=128
[Field 3]
Type=RadioButton
Text=I DO NOT AGREE
Flags=NOTIFY
State=1
Left=10
Right=110
Top=131
Bottom=139 !define FILE_INI "LicensePage.ini"
!include "MUI.nsh"
!include "Sections.nsh"
!include WinMessages.nsh
Page custom License LicenseLeave ""
!insertmacro MUI_PAGE_INSTFILES
OutFile "test.exe"
Section "dummy"
SectionEnd
Function .onInit
!insertmacro MUI_INSTALLOPTIONS_EXTRACT ${FILE_INI}
FunctionEnd
Function License
!insertmacro MUI_HEADER_TEXT "License the product" "Please read the license carefully."
InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR\${FILE_INI}"
GetDlgItem $1 $HWNDPARENT 1
EnableWindow $1 0
InstallOptions::show
FunctionEnd
Function LicenseLeave
ReadINIStr $0 "$PLUGINSDIR\${FILE_INI}" "Settings" "State"
IntCmp $0 0 validate
IntCmp $0 2 I_AGREE
IntCmp $0 3 I_DO_NOT_AGREE
Abort
I_DO_NOT_AGREE:
GetDlgItem $1 $HWNDPARENT 1
EnableWindow $1 0
GetDlgItem $1 $HWNDPARENT 2
EnableWindow $1 0
Abort
I_AGREE:
GetDlgItem $1 $HWNDPARENT 1
EnableWindow $1 1
GetDlgItem $1 $HWNDPARENT 2
EnableWindow $1 1
Abort
validate:
FunctionEnd