Skip to content
⌘ NSIS Forum Archive

Activating NEXT depends on RadioButton in custom IO

4 posts

Brummelchen#

Activating NEXT depends on RadioButton in custom IO

How can i activate the NEXT button depending on two radiobuttons in a custom IO ?
(the RB are off by default)

i already have

!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "menu01.ini"
Pop $HWND

!insertmacro MUI_INSTALLOPTIONS_SHOW_RETURN
Pop $R9

to get chosen action

thx
goldy1064#
If you mean go on to the next page, when checking which radio button was selected, if the right one was selected do nothing in the leave function for the custom page.
Brummelchen#
hmm, leave function - thats not really what i want.

for now, the NEXT button is active by IO ini.
but in future it is disabled and when chosen one RB
it gets enabled.

the "custom" page for the io (menu.ini) contains also
the code behind the radio buttons.

but when i separate code from page - can i use this part further (green part)?
!insertmacro MUI_INSTALLOPTIONS_SHOW_RETURN
Pop $R9

StrCmp $R9 "back" method_readme
StrCmp $R9 "cancel" method_quit
;StrCmp $R9 "success" 0 selectactionend
Brummelchen#
not really successfully


  Page custom method method_leave  ;install or deinstall
  Page custom method2 ;action
Function method
  method_start:
  ;skip if silent
  IfSilent method_quit
  ;search firefox
  Call find_firefox
  ;method_start:
  WriteIniStr $PLUGINSDIR\menu02.ini "Field 2" State 0
  WriteIniStr $PLUGINSDIR\menu02.ini "Field 4" State 0
  ;show dialog
  !insertmacro MUI_HEADER_TEXT "Take your choice" ""
  !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "menu02.ini"
  Pop $HWND
    ;disable next button
    GetDlgItem $R0 $HWNDPARENT 1
    EnableWindow $R0 0 # 0=hide, 1=show
  !insertmacro MUI_INSTALLOPTIONS_SHOW_RETURN
  Pop $R9
  messagebox mb_ok "'$R9'"
  StrCmp $R9 "back" method_readme
  StrCmp $R9 "cancel" method_quit
  ;StrCmp $R9 "success" 0 selectactionend
    return
  ;show readme
  method_readme:
    ExecShell "open" "$PLUGINSDIR\readme.txt"
  Goto method_start
  method_quit:
    Quit
FunctionEnd
Function method_leave
  ;messagebox mb_ok "'$R9'"
  StrCmp $R3 "1" method_leave_ok2
  ;option chosen ?
  !insertmacro MUI_INSTALLOPTIONS_READ $R1 "menu02.ini" "Field 2" "State"
  !insertmacro MUI_INSTALLOPTIONS_READ $R2 "menu02.ini" "Field 4" "State"
  IntOp $R3 $R1 + $R2
  StrCmp $R3 "1" 0 method_leave_abort
    WriteIniStr $PLUGINSDIR\menu02.ini "Field 2" Flags ""
    WriteIniStr $PLUGINSDIR\menu02.ini "Field 4" Flags ""
    GetDlgItem $R0 $HWNDPARENT 1
    EnableWindow $R0 1 # 0=hide, 1=show
  method_leave_abort:
    Abort
  method_leave_ok2:
FunctionEnd 
$R9 returns always "success" when i click second time on any radio button - thats no good

[Field 2]
Type=RadioButton
Text=Install
Left=50
Right=300
Top=5
Bottom=17
State=0
Flags=NOTIFY

[Field 4]
Type=RadioButton
Text=Deinstall
Left=50
Right=300
Top=35
Bottom=47
State=0
Flags=NOTIFY
On NOTIFY the page is left to the leave function which enables the NEXT button (BACK is bundled with a readme).