bwinterscheidt
10th July 2008 20:48 UTC
Complicated section selection
I've been trying to modify any sample I can find, RadioButtons, Mutually Exclusive Sections, Section Dependency, to make some extremely complex section interactions work, but can't get anything to function the way I'd like.
The biggest problems I keep running into are
1) needing three or more mutually exclusive sections (RadioButtons does this, but any other way I can't figure out how to have more than two)
2) with the option to uncheck ALL choices in a group (RadioButtons *doesn't* do this), and
3) multiple dependencies/interactions for a single section: as outlined below, I can get interaction A to work, but then interaction C is ignored for section 1.1 .
Is this complexity even possible?
Here's more detail on my specific scenario:
Group1
-1.1
-1.2
Group2
-2.1
-2.2
-2.3
Group3
-Group4
--3.1
--Group5
---3.1.a
-3.2
Interactions:
A) 1.1 and 1.2 are mutually exclusive, but need to be able to have all unchecked.
B) 2.1, 2.2 and 2.3 are mutually exclusive, but need to be able to have all unchecked.
C) 1.1 and 2.1 are required for/dependent on each other. If you check one, the other should check. If you uncheck one, the other should uncheck.
D) 3.1 (but not Group5/3.1.a) should become disabled if anything in Group1, or item 3.2 are checked. Re-enabled when these conditions are no longer met.
E) When 2.3 is checked, or when all of Group2 is unchecked, 3.2 should be checked by default, but able to be unchecked.
bwinterscheidt
11th July 2008 14:32 UTC
Here's one piece of code I'm having trouble with:
Function .onSelChange
Push $0
;Can't Select multiple sections here
check_one:
StrCmp $R9 ${ONE} check_two
SectionGetFlags ${ONE} $0
IntOp $0 $0 & ${SF_SELECTED}
IntCmp $0 ${SF_SELECTED} 0 done_one done_one
StrCpy $R9 ${ONE}
SectionGetFlags ${TWO} $0
IntOp $0 $0 & ${SECTION_OFF}
SectionSetFlags ${TWO} $0
Goto done_one
check_two:
SectionGetFlags ${TWO} $0
IntOp $0 $0 & ${SF_SELECTED}
IntCmp $0 ${SF_SELECTED} 0 done_one done_one
StrCpy $R9 ${TWO}
SectionGetFlags ${ONE} $0
IntOp $0 $0 & ${SECTION_OFF}
SectionSetFlags ${ONE} $0
done_one:
;Can't Select multiple sections, except third one doesn't work
check_three:
StrCmp $R8 ${THREE} check_four
SectionGetFlags ${THREE} $0
IntOp $0 $0 & ${SF_SELECTED}
IntCmp $0 ${SF_SELECTED} 0 done_three done_three
StrCpy $R8 ${THREE}
SectionGetFlags ${FOUR} $0
IntOp $0 $0 & ${SECTION_OFF}
SectionSetFlags ${FOUR} $0
SectionGetFlags ${FIVE} $0
IntOp $0 $0 & ${SECTION_OFF}
SectionSetFlags ${FIVE} $0
Goto done_three
check_four:
StrCmp $R8 ${FOUR} check_five
SectionGetFlags ${FOUR} $0
IntOp $0 $0 & ${SF_SELECTED}
IntCmp $0 ${SF_SELECTED} 0 done_three done_three
StrCpy $R8 ${FOUR}
SectionGetFlags ${THREE} $0
IntOp $0 $0 & ${SECTION_OFF}
SectionSetFlags ${THREE} $0
SectionGetFlags ${FIVE} $0
IntOp $0 $0 & ${SECTION_OFF}
SectionSetFlags ${FIVE} $0
Goto done_three
check_five:
SectionGetFlags ${FIVE} $0
IntOp $0 $0 & ${SF_SELECTED}
IntCmp $0 ${SF_SELECTED} 0 done_three done_three
StrCpy $R8 ${FIVE}
SectionGetFlags ${THREE} $0
IntOp $0 $0 & ${SECTION_OFF}
SectionSetFlags ${THREE} $0
SectionGetFlags ${FOUR} $0
IntOp $0 $0 & ${SECTION_OFF}
SectionSetFlags ${FOUR} $0
done_three:
Pop $0
FunctionEnd
Function .onInit
Push $0
;Setup initial state for Group1 to match initial InstType
StrCpy $R9 ${TWO}
SectionGetFlags ${TWO} $0
IntOp $0 $0 | ${SF_SELECTED}
SectionSetFlags ${TWO} $0
SectionGetFlags ${ONE} $0
IntOp $0 $0 & ${SECTION_OFF}
SectionSetFlags ${ONE} $0
;Setup initial state for Group2 to match initial InstType
StrCpy $R8 ${THREE}
SectionGetFlags ${THREE} $0
IntOp $0 $0 | ${SF_SELECTED}
SectionSetFlags ${THREE} $0
SectionGetFlags ${FOUR} $0
IntOp $0 $0 & ${SECTION_OFF}
SectionSetFlags ${FOUR} $0
SectionGetFlags ${FIVE} $0
IntOp $0 $0 & ${SECTION_OFF}
SectionSetFlags ${FIVE} $0
Pop $0
FunctionEnd
bwinterscheidt
11th July 2008 20:53 UTC
After much work, I've abandoned the strategies here, and come *close* (not perfect) using If/Select/etc. from LogicLib, combined with a lot of manual flag setting/unsetting...