Skip to content
⌘ NSIS Forum Archive

Depending Sections

5 posts

DOCa Cola#

Depending Sections

How can i make a section depending on another in the component selection page?
for example
Section A - Can always be selected
Section B - Can only be installed if Section A is also selected

DOCa Cola
deguix#
Use this code:

Function .onSelChange
Push $0
Push $1
SectionGetFlags "${SECTION_A}" $0
SectionGetFlags "${SECTION_B}" $1
IntOp $1 $1 & ${SF_SELECTED}
IntCmp $1 ${SF_SELECTED} 0 +3 +3
  StrCpy $1 0
  SectionSetFlags "${SECTION_B}" $1
IntOp $0 $0 & ${SF_SELECTED}
IntCmp $0 ${SF_SELECTED} 0 +3 +3
  StrCpy $1 ${SF_SELECTED}
  SectionSetFlags "${SECTION_B}" $1
Pop $1
Pop $0
FunctionEnd 
deguix#
I forgot this before the code:

!define SF_SELECTED 1 
OR

!include "${NSISDIR}\\Include\\Sections.nsh"