Old 17th April 2006, 11:13   #1
wirelessjava
Junior Member
 
Join Date: Apr 2006
Posts: 5
Custom page checkbox {IF} logic

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?
wirelessjava is offline   Reply With Quote
Old 17th April 2006, 13:08   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
SectionIsSelected is for NSIS Sections.


${If} $R1 = 1
MessageBox MB_OK 'Radio selected'
${EndIf}

-Stu
Afrow UK is offline   Reply With Quote
Old 17th April 2006, 14:36   #3
wirelessjava
Junior Member
 
Join Date: Apr 2006
Posts: 5
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?
wirelessjava is offline   Reply With Quote
Old 17th April 2006, 15:58   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 17th April 2006, 19:13   #5
wirelessjava
Junior Member
 
Join Date: Apr 2006
Posts: 5
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.
wirelessjava is offline   Reply With Quote
Old 17th April 2006, 20:22   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Please attach your script. There isn't any more I can do without it.

-Stu
Afrow UK is offline   Reply With Quote
Old 17th April 2006, 22:06   #7
wirelessjava
Junior Member
 
Join Date: Apr 2006
Posts: 5
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 "
Attached Files
File Type: nsi testcustom.nsi (3.6 KB, 118 views)
wirelessjava is offline   Reply With Quote
Old 18th April 2006, 08:41   #8
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Attached Files
File Type: nsi testcustom.nsi (3.6 KB, 147 views)
Afrow UK is offline   Reply With Quote
Old 18th April 2006, 11:08   #9
wirelessjava
Junior Member
 
Join Date: Apr 2006
Posts: 5
Wow, that's some level of support I must say. Quite amazing!

And again, thank you for your time in resolving my problem.
wirelessjava is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump