Skip to content
⌘ NSIS Forum Archive

Radio select

5 posts

Potz#

Radio select

I was wondering how I would get it to where a certain procedure runs depending on which radio button is selected. For example, I would like someone installing the software to select either Client or Server from 2 radio buttons. If it is a client there would be code to go change the IP address in a text file by them typing in the servers IP address they need to connect to(which I can do already). But I want the option to choose server so it doesn’t change any IP address in the text box.
Afrow UK#
You don't need to do it when the radio button changes. Just do it in the Leave function of the custom page.

-Stu
Potz#
ok... so how would you do that? I am still unsure of how to do things in the NSIS coding. I looked for some examples of leave function but I was unsure if I found the right one. Any help would be very much appreciated. Thanks
Afrow UK#
If you have a custom InstallOptions page, in the Leave function you check the State attribute of your Fields. Read the values with !insertmacro MUI_INSTALLOPTIONS_READ.

-Stu
Potz#
ok so this is the way I have it now

;IP address change------------------------------------
Function ServerIP

!insertmacro MUI_HEADER_TEXT "Server IP Address Change" "This is for Clients only, if this is a server you are installing on then place localhost in the text area."

!insertmacro MUI_INSTALLOPTIONS_EXTRACT "ServerIP.ini"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "ServerIP.ini"
ReadINIStr $3 "$PLUGINSDIR\ServerIP.ini" "Field 5" "State"
ReadINIStr $0 "$PLUGINSDIR\ServerIP.ini" "Field 2" "State"


Push localhost ;text in line to replace
Push $0 ;replace with
Push 169
Push "$DESKTOP\dashboard.properties"
Call ReplaceOnLine

Push localhost ;text in line to replace
Push $0 ;replace with
Push 173
Push "$DESKTOP\dashboard.properties"
Call ReplaceOnLine
FunctionEnd
;------------------------------------------------------

field 5 is a check box. What I was going to do is have a radio button for either server or client, but this way should work too. I still can't find how to use the leave function. I looked on the nsis site and didn't see anything I was looking for. Can you tell me how to do this oor point me in the right direction? Thanks