Archive: Choosing 1 out of 3 sections


Choosing 1 out of 3 sections
I need to allow a user to select only 1 out of 3 sections in the components page, and I don't want to use radiobuttons because they can't be unselected. So I'm hoping someone can help me make something somehow exactly like this only for 3 options and not only 2. I tried making my own but no luck. The three sections are ${addc} ${addcb} and ${adp}.

Thank you


anyone ?


one-section.nsi in NSIS\examples should help.
is that what are you searching for ?

OJi.


Originally posted by OJi
one-section.nsi in NSIS\examples should help.
is that what are you searching for ?

OJi.
Nope I'm not looking for radiobuttons... I already showed a link for a peice of code made by AfrowUK and what I'm looking for is the same thing but for 3 options not only 2.

Try this code:


!define LOGICLIB_SECTIONCMP
!include LogicLib.nsh
...
Function .onInit
...
StrCpy $5 ${addc}
...
FunctionEnd
...
Function .onSelChange
${If} ${SectionIsSelected} ${addc}
${OrIf} ${SectionIsSelected} ${addcb}
${OrIf} ${SectionIsSelected} ${adp}
!insertmacro StartRadioButtons $5
!insertmacro RadioButton ${addc}
!insertmacro RadioButton ${addcb}
!insertmacro RadioButton ${adp}
!insertmacro EndRadioButtons
${EndIf}
FunctionEnd

Here Radiobutton script is activated only if one of sections was selected.

but radiobuttons can't be unselected :S


This code allow you to unselect all sections. Try it.


Originally posted by glory_man
This code allow you to unselect all sections. Try it.
I didn't quite understand it's algorithim so sorry for being prejudgemental. It worked fine. Thanks :)

About algorithim - it's easy.
Radiobutton script allow you to choice only one of 3 sections. So $5-variable keep this (single) section id.
If you deselect this section you need to skeep radiobutton script (If - OrIf - OrIf statements) [$5 keep id of last selected section]. Next time you select section - radiobutton script activate again.