|
|
#1 |
|
Junior Member
Join Date: Jan 2007
Posts: 22
|
Radio buttons and Next Button
I've searched through the forums and i've found part of my answer however i still can't seem to get the Next button to be active.
If i had this ini: [Settings] NumFields=3 [Field 1] Type=RadioButton Text=Option1 Left=42 Right=-1 Top=11 Bottom=20 [Field 2] Type=RadioButton Text=Option2 Left=42 Right=-1 Top=33 Bottom=48 [Field 3] Type=RadioButton Text=Option3 Left=42 Right=-1 Top=59 Bottom=73 and my nsi was something like this: Page custom ChooseSetup . . . Function ChooseSetup ;******Disable the NEXT button, until a radio button has been clicked GetDlgItem $1 $HWNDPARENT 1 EnableWindow $1 0 !insertmacro MUI_HEADER_TEXT "Choose a Setup" "Choose which Setup you want to install." !insertmacro MUI_INSTALLOPTIONS_DISPLAY "$PLUGINSDIR\SetupOptions.ini" FunctionEnd How do I enable the "Next" button once a radio button has been clicked? I've looked at testnotify.nsi, but if i did the "Page custom ChooseSetup ChooseSetup_Leaving" the ChooseSetup_Leaving only works if I left the page and thus have already clicked Next. I thought if i did the follwing it would work: ReadIniStr $0 '$PLUGINSDIR\SetupOptions.ini' "Field 1" "State" ReadIniStr $1 '$PLUGINSDIR\SetupOptions.ini' "Field 2" "State" ReadIniStr $2 '$PLUGINSDIR\SetupOptions.ini' "Field 3" "State" ${If} $1 == 1 ${OrIf) $2 == 1 $(OrIf) $3 == 1 GetDlgItem $1 $HWNDPARENT 1 EnableWindow $1 0 ${EndIf} where am i going wrong? Thanks. |
|
|
|
|
|
#2 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,337
|
You must use the NOTIFY flag on the radio buttons for the leave function to be called when they're clicked.
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Jan 2007
Posts: 22
|
great thanks! but what if i didn't want to leave the page and i wanted them to have to click NEXT in order to get to the next page?
|
|
|
|
|
|
#4 |
|
Moderator
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
|
NOTIFY ensures the leave function is called. In there you need to check which radio button was selected (read from Settings>State to get the field # of the radio button). Call Abort to go back to the page, or rather to prevent the user leaving the page.
GetDlgItem $R0 $HWNDPARENT 1 EnableWindow $R0 0 That will disable the next button. Stu Need an installer? http://www.afrowsoft.co.uk |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Jan 2007
Posts: 22
|
ok i tried what you suggested. However the is still something wrong. my leave function looks like this:
Function ChooseSetup_Leave GetDlgItem $R0 $HWNDPARENT 1 EnableWindow $R0 1 IntCmp $0 0 validate Abort validate: MessageBox MB_ICONEXCLAMATION|MB_OK "Just a Message" Abort FunctionEnd what happens is that when I select one of my radio buttons, it will automatically generate the MessageBox. The MessageBox should only appear when I hit Next. From what I've read 0 is the Next Button. I'm using V2.1, if it helps. |
|
|
|
|
|
#6 |
|
Junior Member
Join Date: Jan 2007
Posts: 22
|
one more thing, because of the Abort in
. . . validate: MessageBox MB_ICONEXCLAMATION|MB_OK "You must select at least one install option!" Abort I also can't leave the page when I press Next. |
|
|
|
|
|
#7 |
|
Moderator
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
|
code: Stu Need an installer? http://www.afrowsoft.co.uk |
|
|
|
|
|
#8 |
|
Junior Member
Join Date: Jan 2007
Posts: 22
|
awesome! thanks a bunch!
|
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|