Old 8th July 2009, 11:14   #1
Icks92
Junior Member
 
Join Date: Apr 2009
Posts: 48
Question To force the state of a chekbox or other buttons

Hello,

I am looking to force the state of my buttons, in my .nsi file, on a custom page.

First, I would like to force the checkbox on "check" and fix it on check. So the function Onclick is useless.

Second, I have different radio buttons on my custom page, and I would like them all to be select at the loading of the page. Because, by default, the first on is select.

Thank you by advance to your precious help.

Have a good day.

An exemple of my tests, maybe, I am on the write way ?! :

${NSD_CreateCheckBox} 15u 30u 56u 45u MyText
Pop $R0
StrCpy $R0 1
SetCtlColors $R0 ${LabelTextColor} ${LabelBackgroundColor}
${NSD_GetState} $R0 $1
StrCmp $R0 0 0 next
StrCpy $R0 1
next: ...
Icks92 is offline   Reply With Quote
Old 8th July 2009, 15:35   #2
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
To check a checkbox use
code:
${NSD_Check} $R0
To disable a control use
code:
${NSD_AddStyle} $R0 ${WS_DISABLED}
To be able to enable the checkbox later, use a global variable instead of $R0, and then use
code:
EnableWindow $MyCheckBox 1 ; 0 = disabled, 1 = enabled
to enable the checkbox.

Do you mean to check all radiobuttons at the same time?
That's against the nature of a radiobutton.
You can use
code:
${NSD_Check} $R1
on all radiobuttons to have them all selected at the same time.
But as soon as you select one of them, the rest will become unchecked.

Please read the nsDialogs documentation, it's all there:
http://nsis.sourceforge.net/Docs/nsD...tml#mref-check

JP
jpderuiter is offline   Reply With Quote
Old 9th July 2009, 07:20   #3
Icks92
Junior Member
 
Join Date: Apr 2009
Posts: 48
Oh sorry I made a mistake, I would like all my radio buttons be unselected at the loading of the page !!

For the moment I managed to unselect them all, but now I can't select them anymore ! When I valid my selection, it consider that all the radio buttons are unselected !!
Icks92 is offline   Reply With Quote
Old 9th July 2009, 10:57   #4
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
If you just create radiobuttons, without using ${NSD_Check} or anything, all radiobuttons will be unchecked.

What do you mean you can't select them anymore?
Can you give a small script which reproduce your problem?
jpderuiter 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