Archive: Required Section within a group


Required Section within a group
  Hi

How do I have a section within a group that is required if the group is ticked.

i.e.

Group
-Shared Components
-Program 1
-Program 2
-Program 3

If P1/2/3 are checked then shared must be, if group is unchecked then don't install shared.

I tried RO on the shared section but that means i can't uncheck the group.


Put your user chosen sections in the group. Add a section outside of the group, before or after, depending on if these "shared" things need to be installed before or after the other section. Make the shared section hidden with the hyphen in the beginning of the name, and make it readonly so that it can't be deselected. Inside of the shared section, wrap all you logic with (IsPartiallySelected OR IsSelected) logic so that it doesn't actually do anything unless at least on item in the group is checked. The reason you need the OR IsSelect is because IsPartiallySelected would evaluate to false if all three of the sections it contains are checked. The below is an example. I think this requires the FileFunc and LogicLib headers. Search the wiki for IsPartiallySelected to verify what dependencies there are.


Section "-Programs Prerequs" ProgramsPrerequs

SectionIn RO ;make sure nothing can deselect it
$(If} ${SectionIsPartiallySelected} ${ProgramsSectionGroup}
${
OrIf} ${SectionIsSelected} ${ProgramsSectionGroup}
;Install postrequs here, this is only run if at least one selection in the group is made
${EndIf}
>SectionEnd

SectionGroup"Programs" ProgramsSectionGroup
Section"Program 1" Program1
InstallStuffHere
SectionEnd
Section"Program 2" Program2
InstallStuffHere
SectionEnd
Section"Program 2" Program2
InstallStuffHere
SectionEnd
SectionGroupEnd

Section"-Programs Postrequs" ProgramsPostrequs
SectionIn RO ;make sure nothing can deselect it
$(If} ${SectionIsPartiallySelected} ${ProgramsSectionGroup}
${OrIf} ${SectionIsSelected} ${ProgramsSectionGroup}
;Install postrequs here, this is only run if at least one selection in the group is made
${EndIf}

>SectionEnd
>

Thanks, this seems to be doing the job :)