Archive: Section toggle


Section toggle
I would like to create two sections in my installer wich can't be selected together. I wan't them only to be i one of these states: both unselected. Only section A selected or only section B selected. Does someone have an example script for me?

thank you in advance!


The google keyword is 'mutually exclusive sections'.


Wonderfull google keyword. Was searching on a bunch of terms, but this hits the nail right on the spot!

Thank you very very much!!


still a little problem here, but i'm comming closer. When i add this to my script i can use it for two sections. How would a make it work for another two sections?

example:
A
B
C
D

I can choose either A or B or none of them AND
I can choose either C or D or none of them
AB and CD are independend from each other.

thx!


Simply duplicate the code, and use a second variable to keep track of the second section group.


Hi,

thank you for your guidance. I have it almost working. Problem is that selecting sectionB doesn't unselect sectionA anymore when one has selected sectionC or D
I have to manually unselect sectionA to be able to select sectionB again. Most likely something stupid i've done, but perhaps it's easily fixed. I've pasted my code below.

Function .onSelChange
Push $0

StrCmp $R9 ${-secA} check_-secA

SectionGetFlags ${-secA} $0
IntOp $0 $0 & ${SF_SELECTED}
IntCmp $0 ${SF_SELECTED} 0 done done
StrCpy $R9 ${-secA}
SectionGetFlags ${-secB} $0
IntOp $0 $0 & ${SECTION_OFF}
SectionSetFlags ${-secB} $0

Goto done

check_-secA:

SectionGetFlags ${-secB} $0
IntOp $0 $0 & ${SF_SELECTED}
IntCmp $0 ${SF_SELECTED} 0 done done
StrCpy $R9 ${-secB}
SectionGetFlags ${-secA} $0
IntOp $0 $0 & ${SECTION_OFF}
SectionSetFlags ${-secA} $0
done:
Pop $0
Push $1
StrCmp $R9 ${-secC} check_-secC

SectionGetFlags ${-secC} $1
IntOp $1 $1 & ${SF_SELECTED}
IntCmp $1 ${SF_SELECTED} 0 done2 done2
StrCpy $R9 ${-secC}
SectionGetFlags ${-secD} $1
IntOp $1 $1 & ${SECTION_OFF}
SectionSetFlags ${-secD} $1

Goto done2

check_-secC:

SectionGetFlags ${-secD} $1
IntOp $1 $1 & ${SF_SELECTED}
IntCmp $1 ${SF_SELECTED} 0 done2 done2
StrCpy $R9 ${-secD}
SectionGetFlags ${-secC} $1
IntOp $1 $1 & ${SECTION_OFF}
SectionSetFlags ${-secC} $1

done2:
Pop $1
FunctionEnd


thank you,
Martin

Sorry, found my error.
I was using $R9 two times. Changed one instance to $R8 and working flawless now.

thank you!