Archive: Grouped RadioButtons


Grouped RadioButtons
  Hi, I add a custom page to my nsis installer, with readiogroups, but i can't separate them in to groups.

this is my code:


# Create controls and set defaults

!define NSD_ADD_STYLE ${WS_GROUP}
${
NSD_CreateGroupBox} 0u 0u 100% 64u " Perform Backup: "
Pop $0

${NSD_CreateRadioButton} 10% 12u 50% 10u "Every week"
Pop $BackupTime1

${NSD_CreateRadioButton} 10% 24u 50% 10u "Every month"
Pop $BackupTime2

${NSD_CreateRadioButton} 10% 36u 50% 10u "Every two month"
Pop $BackupTime3

${NSD_CreateRadioButton} 10% 48u 50% 10u "Never"
Pop $BackupTime4


; !define NSD_ADD_STYLE ${WS_GROUP2}
${NSD_CreateGroupBox} 0u 70u 100% 54u " Perform Backup to: "
Pop $0

${NSD_CreateRadioButton} 10% 82u 50% 10u "Save to disk"
Pop $BackupWhere1


${NSD_CreateRadioButton} 10% 108u 50% 10u "Burn to DVD"
Pop $BackupWhere2
>
how you can see, I have 4 $BackupTime radioButtons and 2 BackupWhere.

Can helpme ?

thx

Crandel

may be this page help u.


link

nsis.sourceforge.net/Docs/InstallOptions/Readme.html


Hi,

I came across the same problem.
The thing is that the first radiobutton in a group has to have the "WS_GROUP" style.
At first I used the following solution; creating a new Macro:

!define NSD_CreateRadioButtonFirst "nsDialogs::CreateControl /NOUNLOAD ${__NSD_RadioButton_CLASS} ${__NSD_RadioButton_STYLE}|${WS_GROUP} ${__NSD_RadioButton_EXSTYLE}"

Now to make a group of radiobuttons:
${NSD_CreateRadioButtonFirst} <Coördinates> "First"
Pop $FirstControl
${NSD_CreateRadioButton} <Coördinates> "Second"
Pop $SecondControl
${NSD_CreateRadioButton} <Coördinates> "Third"
Pop $ThirdControl

Since NSIS version 2.36 it is possible to use the Add_Style macro.
To make the same group of radiobuttons
${NSD_CreateRadioButton} <Coördinates> "First"
Pop $FirstControl
${NSD_AddStyle} $FirstControl ${WS_GROUP}
${NSD_CreateRadioButton} <Coördinates> "Second"
Pop $SecondControl
${NSD_CreateRadioButton} <Coördinates> "Third"
Pop $ThirdControl


Regards,
JP

Thanks for yours answers !!!

the example work perfectly :up: