Archive: Section Question


Section Question
I have multiple installer sections (components) and I have one that I want to be hidden, but only installed when one of the visible sections is installed.

How can I do that? I tried just grouping them, but the hidden section still installs regardless of which visible sections I have selected.


check at runtime inside the section you might want to skip using code from sections.nsh

Section
${If} ${SectionSomethingHERE}
all of the section code
${EndIf}
SectionEnd


Originally posted by Anders
check at runtime inside the section you might want to skip using code from sections.nsh

Section
${If} ${SectionSomethingHERE}
all of the section code
${EndIf}
SectionEnd
I wasn't using sections.nsh.
What would I put for ${SectionSomethingHERE}? Obviously the condition that the visible section was selected, but how do I articulate that?

OutFile "test.exe"
ShowInstDetails show

Page components
page instfiles

!include "Sections.nsh"
!include "logiclib.nsh"

Section "" sec1
DetailPrint "Installing hidden section (sec1)"
SectionEnd

Section "when unselected hidden section unselected too" sec2
DetailPrint "Installing when unselected hidden section unselected too (sec2)"
SectionEnd

Section /o "another section" sec3
DetailPrint "Installing another section (sec3)"
SectionEnd

Function .onSelChange
SectionGetFlags ${sec2} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
${IfThen} $R0 != ${SF_SELECTED} ${|} !insertmacro UnSelectSection ${sec1} ${|}
${IfThen} $R0 = ${SF_SELECTED} ${|} !insertmacro SelectSection ${sec1} ${|}
FunctionEnd

with the logiclib, you can do ${If} ${SectionIsSelected} foo, but the code Red Wine will do fine aswell and will even work when the hidden section is executed first

I was thinking along the lines of


Section Hello HELLO
SectionEnd

Section
${If} ${SectionIsSelected} ${HELLO}
#code here
${Endif}
SectionEnd

Well thanks to both of you! I ended up using red wines code. Though it took me a while to figure out that the function needs to come after the sections! Serves me right for not reading the log while it compiled.