I have a checkbox on a custom page and am reading it in as so:
ReadINIStr $R1 $INI "Field 2" "State"
However I am having problems knowing what state the buton is in:
${If} ${SectionIsSelected} $R1
MessageBox MB_OK 'Radio selected'
I've tried it many ways.
What is the easiest way to detect true/false of a radio button?
Custom page checkbox {IF} logic
9 posts
SectionIsSelected is for NSIS Sections.
${If} $R1 = 1
MessageBox MB_OK 'Radio selected'
${EndIf}
-Stu
${If} $R1 = 1
MessageBox MB_OK 'Radio selected'
${EndIf}
-Stu
Ah, thank you.
It always seems to return 0 or the value of state when set, regardless of the radio box checked or not.
ini file:
[Field 4]
Type=RadioButton
Left=60
Right=-220
Top=50
Bottom=80
read in :
ReadINIStr $R4 $INI "Field 4" "State"
your new code:
${If} $R4 = 1
MessageBox MB_OK 'Radio selected'
${EndIf}
The message only appears if I change the if to 0 instead of 1.
any ideas?
It always seems to return 0 or the value of state when set, regardless of the radio box checked or not.
ini file:
[Field 4]
Type=RadioButton
Left=60
Right=-220
Top=50
Bottom=80
read in :
ReadINIStr $R4 $INI "Field 4" "State"
your new code:
${If} $R4 = 1
MessageBox MB_OK 'Radio selected'
${EndIf}
The message only appears if I change the if to 0 instead of 1.
any ideas?
Where is this code to read the value of the page?
It can't be directly after the InstallOptions call, but in the pages' Leave function.
-Stu
It can't be directly after the InstallOptions call, but in the pages' Leave function.
-Stu
The ini read is in the LeaveCustom function that I added to the Custom page declaration.
The function seems to be called OK, as im able to get a string from another field i've added to $R1
The IF statement is in the middle of a Section which gets called ok as I can get the message box to popup if i set the condition to 0 instead of 1.
The function seems to be called OK, as im able to get a string from another field i've added to $R1
The IF statement is in the middle of a Section which gets called ok as I can get the message box to popup if i set the condition to 0 instead of 1.
Please attach your script. There isn't any more I can do without it.
-Stu
-Stu
Ok, thank you very much for taking the time.
It's basically a slightly modified Modern UI - HeaderBitmap example.
the testCustom ini :
[Settings]
NumFields=7
[Field 1]
Type=Label
Left=5
Right=-220
Top=10
Bottom=18
Text=Path :
[Field 2]
Type=DirRequest
Left=105
Right=-20
Top=8
Bottom=21
state=c:\temp\folder
[Field 3]
Type=Label
Left=5
Right=-250
Top=60
Bottom=80
Text=Visual Studio :
[Field 4]
Type=RadioButton
Left=60
Right=-220
Top=50
Bottom=80
[Field 5]
Type=Label
Left=110
Right=-150
Top=60
Bottom=80
Text=Dev C++ :
[Field 6]
Type=RadioButton
Left=155
Right=-50
Top=50
Bottom=80
[Field 7]
Type=GroupBox
Left=0
Right=-1
Top=45
Bottom=85
Text=" IDE "
It's basically a slightly modified Modern UI - HeaderBitmap example.
the testCustom ini :
[Settings]
NumFields=7
[Field 1]
Type=Label
Left=5
Right=-220
Top=10
Bottom=18
Text=Path :
[Field 2]
Type=DirRequest
Left=105
Right=-20
Top=8
Bottom=21
state=c:\temp\folder
[Field 3]
Type=Label
Left=5
Right=-250
Top=60
Bottom=80
Text=Visual Studio :
[Field 4]
Type=RadioButton
Left=60
Right=-220
Top=50
Bottom=80
[Field 5]
Type=Label
Left=110
Right=-150
Top=60
Bottom=80
Text=Dev C++ :
[Field 6]
Type=RadioButton
Left=155
Right=-50
Top=50
Bottom=80
[Field 7]
Type=GroupBox
Left=0
Right=-1
Top=45
Bottom=85
Text=" IDE "
Your script was quite a mess really.
You were extracting two copies of testCustom.ini; displaying the InstallOptions dialog from one and then reading values from another!
Also, no need to declare Var INI.
If you need constants, use !define.
-Stu
You were extracting two copies of testCustom.ini; displaying the InstallOptions dialog from one and then reading values from another!
Also, no need to declare Var INI.
If you need constants, use !define.
-Stu
Wow, that's some level of support I must say. Quite amazing!
And again, thank you for your time in resolving my problem.
And again, thank you for your time in resolving my problem.