Archive: How to control Section selections


How to control Section selections
Hi, I have a problem: I have 4 components (A,B,C,D) to install.
1.if A is selected B can't be selected and C is automatically selected.
2. if B is selected C and A can't be selected
3. D can be selected with A,B,C
4. C can be selected alone.
I don't know how to do this. Could somebody help me?
Thanks!!
mamilo


You could implement whichever logic you wish in .onSelChange. Examples\one-section.nsi shows how to implement a logic that forces only one section to be selected at a time. Macros are available in Include\Sections.nsh to make this job easier.


Thanks for your help. But i don't find a way to do what I want.Can you say me how I can do it please!


Hi mamilo!

Try this:


;--------------------------------
;Include Modern UI

!define LOGICLIB_SECTIONCMP

!include "MUI.nsh"
!include "logiclib.nsh"
!include "sections.nsh"

;--------------------------------
;General

;Name and file
Name "Test"
OutFile "test.exe"

;--------------------------------
;Pages

!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES

Section !A secA
SectionEnd

Section /o !B secB
SectionEnd

Section C secC
SectionEnd

Section D secD
SectionEnd

Function .onSelChange

${If} ${SectionIsSelected} ${secB}
!insertmacro UnSelectSection ${secA}
!insertmacro UnSelectSection ${secC}
${EndIf}

${If} ${SectionIsSelected} ${secA}
!insertmacro UnSelectSection ${secB}
!insertmacro SelectSection ${secC}
${EndIf}

FunctionEnd

;--------------------------------
;Languages

!insertmacro MUI_LANGUAGE "English"


Cheers

Bruno

Thanks for your help! it walks !! :up: ;)