Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 25th March 2010, 09:29   #1
ChinnaGanesh
Junior Member
 
Join Date: Mar 2010
Posts: 8
Radio button in NSIS

hi all,

How to include radio button for yes/no option in the dialog.

And the "next" button should enable/disable depends on the above option.

Thanks,
Chinna
ChinnaGanesh is offline   Reply With Quote
Old 25th March 2010, 09:55   #2
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 546
radiobutton:
http://nsis.sourceforge.net/NsDialog...f_RadioButtons

disable next button:
http://forums.winamp.com/showthread.php?postid=2399140
jpderuiter is offline   Reply With Quote
Old 25th March 2010, 10:27   #3
ChinnaGanesh
Junior Member
 
Join Date: Mar 2010
Posts: 8
Thanks for your reply.

I am very new this NSIS..... I am using the following code...

var Group1Radio1
var Group1Radio2

Function WelcomePageSetupRadioButtonPre
;nsDialogs::Create 1018
Pop $dialog
${NSD_CreateRadioButton} 0 0 40% 6% "Group 1, Radio 1"
Pop $Group1Radio1
${NSD_AddStyle} $Group1Radio1 ${WS_GROUP}
${NSD_OnClick} $Group1Radio1 RadioClick
${NSD_CreateRadioButton} 0 12% 40% 6% "Group 1, Radio 2"
Pop $Group1Radio2
${NSD_OnClick} $Group1Radio2 RadioClick

;nsDialogs::Show
FunctionEnd

Function RadioClick
Pop $hwnd
${If} $hwnd == $Group1Radio1
MessageBox MB_OK "onClick:Group1Radio1"
${ElseIf} $hwnd == $Group1Radio2
MessageBox MB_OK "onClick:Group1Radio2"
${EndIf}
FunctionEnd

This is not working out for me... Appreciate you provide a simple example with code...

Thanks,
ChinnaGanesh is offline   Reply With Quote
Old 25th March 2010, 10:39   #4
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 546
What do you mean with 'not working'?
What doesn't work?

What I can see now is that you commented the 'nsDialogs::Create' and 'nsDialogs::Show' out.
Those are required, so you shouldn't do that.
jpderuiter is offline   Reply With Quote
Old 25th March 2010, 10:49   #5
ChinnaGanesh
Junior Member
 
Join Date: Mar 2010
Posts: 8
jpderuiter,

Thank for your quick reply... I understand your saying.

I got an assignment to
1. create two radio buttons (yes/no) on the "Welcome page" which comes an default dialog(not an user defined dialog).
2. Depends upon the above input I have to enable/disable the button (i am not sure how the radio button selection will effect on button)

Appreciate you to provide a simple example code
ChinnaGanesh is offline   Reply With Quote
Old 25th March 2010, 11:06   #6
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 546
OK, well, you can't edit the Welcome page with nsDialogs.
The only way to do that is using a resource editor, like ResourceHacker (search the forum).

The other option is to use a custom page instead of the Welcome page, with the same content as a normal Welcome page, and your radiobuttons.
jpderuiter is offline   Reply With Quote
Old 25th March 2010, 11:14   #7
ChinnaGanesh
Junior Member
 
Join Date: Mar 2010
Posts: 8
thank you jpderuiter....

What is your advice to achieve this output.. using resource editor or create cutom page..

Which one is easier
ChinnaGanesh is offline   Reply With Quote
Old 25th March 2010, 11:17   #8
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 546
I personally prefer using a custom page, as I think it's easier to do.
jpderuiter is offline   Reply With Quote
Old 25th March 2010, 11:27   #9
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,203
Actually the welcome page (and finish page) is made with nsDialogs (MUI2.nsh). Just define an MUI_PAGE_CUSTOMFUNCTION_SHOW for it and then add your controls.

Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 25th March 2010, 11:43   #10
ChinnaGanesh
Junior Member
 
Join Date: Mar 2010
Posts: 8
Thanks stu....

Appreciate you to provide a example code for this....
ChinnaGanesh is offline   Reply With Quote
Old 25th March 2010, 12:28   #11
ChinnaGanesh
Junior Member
 
Join Date: Mar 2010
Posts: 8
Stu,

I am able to add two radio buttons in the welcome page...

Now, how can i make the "next" button to act depends upon the radio buttons' selection.

If Yes, enable "next" button
If No, disable "next" button
ChinnaGanesh is offline   Reply With Quote
Old 25th March 2010, 13:14   #12
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,203
Assign an OnClick event along with using ${NSD_GetState} and EnableWindow.

Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 25th March 2010, 14:39   #13
ChinnaGanesh
Junior Member
 
Join Date: Mar 2010
Posts: 8
Stu,

${NSD_GetState} is for custom dialog.... am i right?

I am looking into Welcome dialog.
ChinnaGanesh is offline   Reply With Quote
Old 25th March 2010, 15:00   #14
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,203
As I've already said, the welcome (and finish) pages are custom pages using nsDialogs.

Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Reply
Go Back   Winamp 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