Skip to content
⌘ NSIS Forum Archive

NSIS Bug (RadioButton problem)

4 posts

BioDuo#

NSIS Bug (RadioButton problem)

I pointed this problem out earlier, only I didn't get any reply so I post my script..

!include "Sections.nsh"

;--------------------------------

Name "One Section"
OutFile "one-section.exe"

;--------------------------------

; Pages

Page components

;--------------------------------

; Sections

Section !Required
SectionIn RO
SectionEnd

SectionGroup /e "SectionGroup Test RadioButton"

Section "Group 1 - Option 1" g1o1
SectionEnd

Section /o "Group 1 - Option 2" g1o2
SectionEnd

Section /o "Group 1 - Option 3" g1o3
SectionEnd
SectionGroupEnd


Function .onInit

StrCpy $1 ${g1o1} ; Group 1 - Option 1 is selected by default

FunctionEnd

Function .onSelChange

!insertmacro StartRadioButtons $1
!insertmacro RadioButton ${g1o1}
!insertmacro RadioButton ${g1o2}
!insertmacro RadioButton ${g1o3}
!insertmacro EndRadioButtons

FunctionEnd
When you click 'SectionGroup Test RadioButton' both Option 1 and 2 jumps on, another click and Option 2 and Option 3 jumps on, is there a way to fix this?
glory_man#
This is not a bug, this is problem of RadioButton macros. Try this code.

!include "LogicLib.nsh"
...
SectionGroup /e "SectionGroup Test RadioButton" sg1
...
Function .onSelChange

${If} ${SectionIsSelected} ${sg1}
!insertmacro UnSelectSection ${sg1}
!insertmacro SelectSection $1
${Else}
!insertmacro StartRadioButtons $1
!insertmacro RadioButton ${g1o1}
!insertmacro RadioButton ${g1o2}
!insertmacro RadioButton ${g1o3}
!insertmacro EndRadioButtons
${EndIf}

FunctionEnd