bl4d3
12th August 2007 20:17 UTC
selecting a subsection change anothers subsection status
hi,
as my subjects says i've the following problem:
if the subsection one is selected, the subsection two should automatically selected by installer. so the user must not select option two manually. the reason why i'm need this, is that option two is required for option one or with other words without installing option two option one isn't working afterwards the installation.
when option two is deselected option one also must automatically deselected.
...
>InstType "Full"
>InstType "Minimum"
>InstType "Custom"
>...
>SectionGroup "first"
>Section /o "option one"
SectionIn 1
...
SectionEnd
Section"option two" //is required and only needed when option one is selected
SectionIn 1 2
...
SectionEnd
Section "option three"
SectionIn 1
...
SectionEnd
...
>SectionGroupEnd
SectionGroup "second"
...
>SectionGroupEnd
>...
i've already searched for a solution, but i'm not sure about what to search. what i have found so far is that it should have to do something with the example
one-section.nsi and
.onSelChange and
SectionSetFlags. problem is, what i've found so far doesn't seem approaching my problem.
can anyone help?
graphically:
Sectiongroup first
[_] option one
[_] option two
[_] option three
...
user make his choice:
Sectiongroup first
[x] option one
[_] option two
[_] option three
...
so the installer sets option two automatically as selected:
Sectiongroup first
[x] option one
[x] option two
[_] option three
...
darthvader
14th August 2007 19:14 UTC
I am not really sure about this method but give it a try
In the .onSelChange function Use the SectionGetFlags for the Section 1 and check if its selected by checking the SF_SELECTED flag. if so then Use the SectionSetFLags for the section 2. Now also check if section 2 is selected without selecting Section 1 by the above method. If so then deselect it by SectionSetFlags.
I hope this helps.
bl4d3
17th August 2007 17:54 UTC
i'm very confused about how to do this stuff. i've searched again and found this topic: h t t p ://forums.winamp.com/showthread.php?s=&threadid=272007&highlight=SectionSetFlags (so sorry guys for my double post)
Afrow UK gives an very good example there on how to do this. i take his code and made an example installer (without the possibility to install of course). see this example in the attached file here.
problem is that i don't really understand what's going on in this code.
another prob is that, you must select "option two" twice beforce the required "option one" is automatically selected.
ps: if a forum moderator read this, i have two questions: why is it impossible two post a link to a nsis forum site and why is it also impossible to search for the keyword "winamp"?
darthvader
18th August 2007 04:10 UTC
Here you go. I have modified the script to be executed correctly.
How does it work??
Assume 2 states which require modification
State 0 : When option 2 is selected option 1 needs to be selected.
State 1: When option 1 is unselected option 2 needs to be deselected.
I have initialized to state 0 in oninit. When it both the options are selected it automatically moves to state 1(since we need to keep checking if option 1 is selected). If option 2 are deselected it moves to state 0(since we need to keep checking for option 2 being checked so that we can check option 1).
I hope my explanation helped.