Archive: Section dependencies


Section dependencies
  In the installer I am writing, I have some tools that are dependent on others. In the component selection page, I can easily write code that selects a tool dependency if that tool is selected.

So if I have Tool_A depending on Tool_B, checking Tool_A will automatically select Tool_B. Here is a diagram of what I mean:


  Start           Click Tool_A    The code selects Tool_B.

***91; ***93;Tool_A ***91;x***93; Tool_A ***91;x***93; Tool_A
-> ->
***91; ***93;Tool_B ***91; ***93; Tool_B ***91;x***93; Tool_B
>
One of the requirements on my installer is that if both deselecting Tool_B will deselect Tool_A as well.


  Start           Click Tool_B    The code deselects Tool_A.

***91;
x***93; Tool_A ***91;x***93; Tool_A ***91; ***93; Tool_A
-> ->
***91;x***93; Tool_B ***91; ***93; Tool_B ***91; ***93; Tool_B
>
I have tried coding this, but I am having problems because the intermediate state of both of these situations is the same.

I guess I am asking is there a way to determine which section has been clicked? Or is there another way to set up dependencies like this?

Thanks in advance.

I'm not sure if this is silly, but why not have one section then?

Stu


Can't have one section...
  ... because it must be possible to install Tool_B without Tool_A, if the user so wishes.

Tool_A won't work without Tool_B, but Tool_B is independent of Tool_A.

:(


Ah I see, let me try.

Stu


There must be an easier way than this, but using your excellent diagram for the logic I came up with:


Section hello1 SEC1
SectionEnd

Section hello2 SEC2
SectionEnd

Var SectionState
Function .onSelChange

SectionGetFlags ${SEC1} $R0
SectionGetFlags ${SEC2} $R1
IntOp $R2 $R0 & ${SF_SELECTED}
IntOp $R3 $R1 & ${SF_SELECTED}

StrCmp $SectionState 0 0 +5
StrCmp $R2 ${SF_SELECTED} 0 +4
IntOp $R1 $R1 | ${SF_SELECTED}
SectionSetFlags ${SEC2} $R1
StrCpy $R3 ${SF_SELECTED}

StrCmp $SectionState 1 0 +5
StrCmp $R3 ${SF_SELECTED} +4
IntOp $R0 $R0 ^ ${SF_SELECTED}
SectionSetFlags ${SEC1} $R0
StrCpy $R2 0

StrCpy $SectionState 2

StrCmp $R2 ${SF_SELECTED} 0 +3
StrCmp $R3 ${SF_SELECTED} 0 +2
StrCpy $SectionState 1

StrCmp $R2 ${SF_SELECTED} +3
StrCmp $R3 ${SF_SELECTED} +2
StrCpy $SectionState 0

FunctionEnd


Stu

Thanks!
  Just what I needed :) Many thanks :D

The crux of the solution was to store the previous transition between the states of the pair of sections.

Basically, what Afrow did was this (arrows indicate direction of logic):


Logic picture:

State = 1
<--

***91; ***93;Tool_A ***91;x***93; Tool_A ***91;x***93; Tool_A

>***91; ***93; Tool_B ***91; ***93; Tool_B ***91;x***93; Tool_B

-->
State = 0
>
Knowing what the previous value transition was lets you work out what the next state should be :)

Shame there's no simpler way to do it.: