nsis 궁금하니?

disable next button in a custom page

deguls 2008. 4. 2. 19:29

출처: http://forums.winamp.com/showthread.php?postid=2056841

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.

PHP:

[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



 

PHP:

!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