Here is my section structure:
[] Goup1
--[] Section1
--[] Section2
[] Goup2
--[] Section3
--[] Section4
What I need to do is to have only one group selected, so when I click on group2 it unselect group1 and select group2.
I did it in onSelChange like this
!insertmacro StartRadioButtons $1
!insertmacro RadioButton ${group1}
!insertmacro RadioButton ${group2}
!insertmacro EndRadioButtons
But what I also need, is if I click on Section3 or Section4 is to unselect Section1 and 2 (and vice versa), and that I didn't figure out how to do it.
It is almost working fine but only when all the sections of a group are selected. It means that I can have group1 and its section selected and partially select group2.
Another problem is that because of this radio behaviour, I am unable to unselect a group section when the group is selected.
Any solution ?
Radio behaviour on group section
2 posts
I just try this based on a script by Afrow UK:
!include MUI.nsh
!include Sections.nsh
OutFile dive2xs.exe
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE English
Var T
;Installer Sections
SectionGroup /e "update" group1
Section "prog1" Section1
SectionEnd
Section "prog2" Section2
SectionEnd
SectionGroupEnd
SectionGroup /e "new install" group2
Section "prog1" Section3
SectionEnd
Section "prog2" Section4
SectionEnd
SectionGroupEnd
Function .onInit
StrCpy $T 0
FunctionEnd
Function .onSelChange
Push $R0
SectionGetFlags ${Section1} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 ${SF_SELECTED} 0 continue1
StrCmp $T ${Section1} continue1
StrCpy $T ${Section1}
Goto UnselectGroup2
continue1:
SectionGetFlags ${Section2} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 ${SF_SELECTED} 0 continue2
StrCmp $T ${Section2} continue2
StrCpy $T ${Section2}
UnselectGroup2:
!insertmacro UnselectSection ${Group2}
continue2:
SectionGetFlags ${Section3} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 ${SF_SELECTED} 0 continue3
StrCmp $T ${Section3} continue3
StrCpy $T ${Section3}
Goto UnselectGroup1
continue3:
SectionGetFlags ${Section4} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 ${SF_SELECTED} 0 continue4
StrCmp $T ${Section4} continue4
StrCpy $T ${Section4}
UnselectGroup1:
!insertmacro UnselectSection ${Group1}
continue4:
Pop $R0
FunctionEnd
It is almost working, but when first group is fully selected, I can not select a secion from the second group.
What did I miss ?
!include MUI.nsh
!include Sections.nsh
OutFile dive2xs.exe
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE English
Var T
;Installer Sections
SectionGroup /e "update" group1
Section "prog1" Section1
SectionEnd
Section "prog2" Section2
SectionEnd
SectionGroupEnd
SectionGroup /e "new install" group2
Section "prog1" Section3
SectionEnd
Section "prog2" Section4
SectionEnd
SectionGroupEnd
Function .onInit
StrCpy $T 0
FunctionEnd
Function .onSelChange
Push $R0
SectionGetFlags ${Section1} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 ${SF_SELECTED} 0 continue1
StrCmp $T ${Section1} continue1
StrCpy $T ${Section1}
Goto UnselectGroup2
continue1:
SectionGetFlags ${Section2} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 ${SF_SELECTED} 0 continue2
StrCmp $T ${Section2} continue2
StrCpy $T ${Section2}
UnselectGroup2:
!insertmacro UnselectSection ${Group2}
continue2:
SectionGetFlags ${Section3} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 ${SF_SELECTED} 0 continue3
StrCmp $T ${Section3} continue3
StrCpy $T ${Section3}
Goto UnselectGroup1
continue3:
SectionGetFlags ${Section4} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 ${SF_SELECTED} 0 continue4
StrCmp $T ${Section4} continue4
StrCpy $T ${Section4}
UnselectGroup1:
!insertmacro UnselectSection ${Group1}
continue4:
Pop $R0
FunctionEnd
It is almost working, but when first group is fully selected, I can not select a secion from the second group.
What did I miss ?