- NSIS Discussion
- Selecting a checkbox automaticaly de-select another?
Archive: Selecting a checkbox automaticaly de-select another?
TeenBurger
13th February 2005 15:30 UTC
Selecting a checkbox automaticaly de-select another?
lets say i have
section a-1
section a-2
section a-3
section b-1
section b-2
section b-3
how do i code it out for user to be able to select both a-1 and b-1 BUT only one of each of a-2 and b-2 and only one of a-3 and b-3 ?
TeenBurger
13th February 2005 16:23 UTC
the problem is that i cant un select a check thats in the macro
Function .onSelChange
!insertmacro StartRadioButtons $1
!insertmacro RadioButton ${g1o1}
!insertmacro RadioButton ${g1o2}
!insertmacro RadioButton ${g1o3}
!insertmacro EndRadioButtons
!insertmacro StartRadioButtons $2
!insertmacro RadioButton ${g2o1}
!insertmacro RadioButton ${g2o2}
!insertmacro RadioButton ${g2o3}
!insertmacro EndRadioButtons
FunctionEnd
if i insert
!insertmacro RadioButton 0
all the checkboxes will go blank but i only want one to go blank
TeenBurger
13th February 2005 16:49 UTC
Found a workaround
Function .onInit
StrCpy $1 ${g1o1} ; Group 1 - Option 1 is selected by default
StrCpy $2 ${g2o1} ; Group 2 - Option 1 is selected by default
FunctionEnd
Function .onSelChange
!insertmacro StartRadioButtons $1
!insertmacro RadioButton ${g1o1}
!insertmacro RadioButton $10
!insertmacro RadioButton ${g1o2}
!insertmacro RadioButton $11
!insertmacro RadioButton ${g1o3}
!insertmacro RadioButton $12
!insertmacro EndRadioButtons
!insertmacro StartRadioButtons $2
!insertmacro RadioButton ${g2o1}
!insertmacro RadioButton $13
!insertmacro RadioButton ${g2o2}
!insertmacro RadioButton $14
!insertmacro RadioButton ${g2o3}
!insertmacro RadioButton $15
!insertmacro EndRadioButtons
FunctionEnd
a little bit ugly but it works pretty well :)
TeenBurger
13th February 2005 17:00 UTC
doesnt work that well...
help me please!
Afrow UK
13th February 2005 18:32 UTC
This works
Section a-1 a-1
SectionEnd
Section a-2 a-2
SectionEnd
Section a-3 a-3
SectionEnd
Section b-1 b-1
SectionEnd
Section b-2 b-2
SectionEnd
Section b-3 b-3
SectionEnd
Var Sec1
Var Sec2
Function .onSelChange
!insertmacro StartRadioButtons $Sec1
!insertmacro RadioButton ${a-2}
!insertmacro RadioButton ${b-2}
!insertmacro EndRadioButtons
!insertmacro StartRadioButtons $Sec2
!insertmacro RadioButton ${a-3}
!insertmacro RadioButton ${b-3}
!insertmacro EndRadioButtons
FunctionEnd
-Stu
TeenBurger
13th February 2005 18:51 UTC
mmmm its not stable maybe because of the SectionGroup?
Afrow UK
13th February 2005 19:05 UTC
What is wrong with it?
Edit: Ok, I see. Let me change something.
-Stu
TeenBurger
13th February 2005 19:06 UTC
My Structure is
SectionGroup "Group1"
Section a-1 a-1
SectionEnd
Section a-2 a-2
SectionEnd
Section a-3 a-3
SectionEnd
SectionGroupEnd
SectionGroup "Group2"
Section b-1 b-1
SectionEnd
Section b-2 b-2
SectionEnd
Section b-3 b-3
SectionEnd
SectionGroupEnd
Var Sec1
Var Sec2
Function .onSelChange
!insertmacro StartRadioButtons $Sec1
!insertmacro RadioButton ${a-2}
!insertmacro RadioButton ${b-2}
!insertmacro EndRadioButtons
!insertmacro StartRadioButtons $Sec2
!insertmacro RadioButton ${a-3}
!insertmacro RadioButton ${b-3}
!insertmacro EndRadioButtons
FunctionEnd
i get weird result some checkboxes wont uncheck and sometimes i can check a-3 and b-3 at the same time
Afrow UK
13th February 2005 19:20 UTC
Fixed:
SectionGroup "Group1"
Section a-1 a-1
SectionEnd
Section a-2 a-2
SectionEnd
Section a-3 a-3
SectionEnd
SectionGroupEnd
SectionGroup "Group2"
Section b-1 b-1
SectionEnd
Section /o b-2 b-2
SectionEnd
Section /o b-3 b-3
SectionEnd
SectionGroupEnd
Var Sec1
Var Sec2
Function .onInit
StrCpy $Sec1 ${a-2}
StrCpy $Sec2 ${a-3}
FunctionEnd
Function .onSelChange
!insertmacro StartRadioButtons $Sec1
!insertmacro RadioButton ${a-2}
!insertmacro RadioButton ${b-2}
!insertmacro EndRadioButtons
!insertmacro StartRadioButtons $Sec2
!insertmacro RadioButton ${a-3}
!insertmacro RadioButton ${b-3}
!insertmacro EndRadioButtons
FunctionEnd
Is that what you want?
-Stu
TeenBurger
13th February 2005 19:37 UTC
i still cant uncheck a-2 b-2 checkboxes when they are checked in =/
Afrow UK
13th February 2005 20:19 UTC
Perhaps you could help by explaining in greater detail of what you require.
-Stu
TeenBurger
13th February 2005 20:23 UTC
i want to be able to completely disable a-2 AND b-2
TeenBurger
13th February 2005 21:30 UTC
i need to set a radiobutton loop
TeenBurger
13th February 2005 22:23 UTC
SectionGroup "Group1"
Section a-1 a-1
SectionEnd
Section a-2 a-2
SectionEnd
Section a-3 a-3
SectionEnd
SectionGroupEnd
SectionGroup "Group2"
Section b-1 b-1
SectionEnd
Section /o b-2 b-2
SectionEnd
Section /o b-3 b-3
SectionEnd
SectionGroupEnd
Var Sec1
Var Sec2
Function .onInit
StrCpy $Sec1 ${a-2}
StrCpy $Sec2 ${a-3}
FunctionEnd
Function .onSelChange
--loop--
!insertmacro StartRadioButtons $Sec1
!insertmacro RadioButton ${a-2}
!insertmacro RadioButton ${null}
!insertmacro RadioButton ${b-2}
!insertmacro RadioButton ${null}
!insertmacro EndRadioButtons
--gotoloop--
!insertmacro StartRadioButtons $Sec2
!insertmacro RadioButton ${a-3}
!insertmacro RadioButton ${b-3}
!insertmacro EndRadioButtons
FunctionEnd
how do i do that ?
TeenBurger
13th February 2005 22:27 UTC
i think im not on the right way
TeenBurger
13th February 2005 22:58 UTC
Originally posted by Afrow UK
Fixed:
SectionGroup "Group1"
Section a-1 a-1
SectionEnd
Section a-2 a-2
SectionEnd
Section a-3 a-3
SectionEnd
SectionGroupEnd
SectionGroup "Group2"
Section b-1 b-1
SectionEnd
Section /o b-2 b-2
SectionEnd
Section /o b-3 b-3
SectionEnd
SectionGroupEnd
Var Sec1
Var Sec2
Function .onInit
StrCpy $Sec1 ${a-2}
StrCpy $Sec2 ${a-3}
FunctionEnd
Function .onSelChange
!insertmacro StartRadioButtons $Sec1
!insertmacro RadioButton ${a-2}
!insertmacro RadioButton ${b-2}
i need a field here that will let me uncheck the box without breaking the macro
!insertmacro EndRadioButtons
!insertmacro StartRadioButtons $Sec2
!insertmacro RadioButton ${a-3}
!insertmacro RadioButton ${b-3}
!insertmacro EndRadioButtons
FunctionEnd
Is that what you want?
-Stu
NHOCSUNG
14th February 2005 01:25 UTC
you how come this can't work
${If} ${SectionIsSelected} ${a-2}
SectionSetFlags ${b-2} "0"
${Else}
SectionSetFlags ${b-2} "1"
${EndIf}
${If} ${SectionIsSelected} ${b-2}
SectionSetFlags ${a-2} "0"
${Else}
SectionSetFlags ${a-2} "1"
${EndIf}
${If} ${SectionIsSelected} ${a-3}
SectionSetFlags ${b-3} "0"
${Else}
SectionSetFlags ${b-3} "1"
${EndIf}
${If} ${SectionIsSelected} ${b-3}
SectionSetFlags ${a-3} "0"
${Else}
SectionSetFlags ${a-3} "1"
${EndIf}
Afrow UK
14th February 2005 12:20 UTC
Ah I see what you mean now...
Ok, let me look.
-Stu
Afrow UK
14th February 2005 12:44 UTC
To do what you want would require you to modify the code in Sections.nsh itself.
I think it'd be easier to just have another radio button in the 1st radio-buttons block which had "No a-2, b-2" as a title (to the effect).
NHOCSUNG, are you asking us if your code works, or asking why we shouldn't use it because it does work? It doesn't work :p
-Stu
NHOCSUNG
15th February 2005 14:19 UTC
my code, it seem like nothing wrong with it right???
why it didn't work???
thanks.