Skip to content
⌘ NSIS Forum Archive

Radio button in NSIS

14 posts

ChinnaGanesh#

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
jpderuiter#
radiobutton:


disable next button:
Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.
ChinnaGanesh#
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,
jpderuiter#
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.
ChinnaGanesh#
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
jpderuiter#
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.
ChinnaGanesh#
thank you jpderuiter....

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

Which one is easier 🙂
Afrow UK#
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
ChinnaGanesh#
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#
Stu,

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

I am looking into Welcome dialog.