Archive: disable next button in a custom page


disable next button in a custom page
  I am having a weird problem. I can not seem to be able to disable the install button in the following script. Just to make sure I am doing everything right I played with disabling the Cancel button and it worked! But I have no idea why the Install button is stubborn or is it me being stupid?

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.


***93;

>NumFields=3
>***91;Field 1***93;
>Type=Text
Left
=10
Right=-10
Top=10
Bottom=110
State=blabla
Flags=MULTILINE|VSCROLL|READONLY

>***91;Field 2***93;
>Type=RadioButton
Text=I AGREE
Flags=NOTIFY
State=0
Left=10
Right=110
Top=120
Bottom=128

>***91;Field 3***93;
>Type=RadioButton
Text=I DO NOT AGREE
Flags=NOTIFY
State=1
Left=10
Right=110
Top=131
Bottom=139
>

"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
>

Your code is dropping through from the "I_DO_NOT_AGREE" section into the "I_AGREE" section. That re-enables the button. You need to exit the funtion or jump to the validate label.


Abort also returns from the function, so that's not the problem.

But when testing the script, I don't see the problem. The Install button is disabled and enabled according to the radio button selection. I don't see any reason with that script that'd happen. Have you any more details for reproducing this?


Hi kichik,

When you said that you were not able to reproduce the problem, I told myself maybe you are using a different version of NSIS. So I went ahead and downloaded the NSIS 2.21 and recompiled my script and now it works.

The version I found this problem with is NSIS 2.0. NSIS 2.21 does fix the problem. I have no explanation why it does not work with NSIS 2.0.

Thanks.