Archive: Radio button in NSIS


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


radiobutton:
http://nsis.sourceforge.net/NsDialog...f_RadioButtons

disable next button:
http://forums.winamp.com/showthread.php?postid=2399140


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,


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,

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


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.


thank you jpderuiter....

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

Which one is easier :)


I personally prefer using a custom page, as I think it's easier to do.


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


Thanks stu....

Appreciate you to provide a example code for this....


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


Assign an OnClick event along with using ${NSD_GetState} and EnableWindow.

Stu


Stu,

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

I am looking into Welcome dialog.


As I've already said, the welcome (and finish) pages are custom pages using nsDialogs.

Stu