Skip to content
⌘ NSIS Forum Archive

Section selection flags

9 posts

pkonduru#

Section selection flags

Hi all,

My installer has a few features say A, B, C and D and I have used the components page via Section /o in my .nsi script.
All sections are unselected by default.

If A is selected B and C have to be disabled. If A is unchecked they have to be enabled again.
I have been trying a lot of things , I could disable the selections B and C when A is selected through this:
Function .onSelChange

${If} ${SectionIsSelected} ${ServerSec}
SectionSetFlags ${DCM32Sec} 16
SectionSetFlags ${DCM64Sec} 16
${EndIf}

FunctionEnd

But am not able to go back to my original position when A is unselected.
Any suggestions will help!!

--Pavan
Anders#
Add a ${Else} block to your if. You should not call SectionSetFlags directly, use the macros in sections.nsh!
pkonduru#
This is what I tried after reading the sections.nsh:

${If} ${SectionIsSelected} ${ServerSec}
SectionSetFlags ${DCM32Sec} ${SF_RO}
SectionSetFlags ${DCM64Sec} ${SF_RO}
${else}
SectionSetFlags ${DCM64Sec} ${SF_SELECTED}
!insertmacro UnselectSection ${DCM64Sec}
SectionSetFlags ${DCM32Sec} ${SF_SELECTED}
!insertmacro UnselectSection ${DCM32Sec}
${EndIf}

--The 2 sections are disabled when I select $ServerSec
--When I unselect both sections are enabled but I am not able to select them on the components page, seem like they are disabled .
pkonduru#
So this is what I did:

${If} ${SectionIsSelected} ${ServerSec}
!insertmacro UnselectSection ${DCM32Sec}
!insertmacro UnselectSection ${DCM64Sec}

${EndIf}

Selecting Serv will not let me choose either of the other 2 sections which is what I want.

The clearSectionsFlag is defined in Sections.nsh as:

!macro ClearSectionFlag SECTION BITS

I am not sure how to use this macro?
pkonduru#
Thanks Anders! This Solved my problem, so can help others:

Function .onSelChange

${If} ${SectionIsSelected} ${ServerSec}
!insertmacro UnselectSection ${DCM32Sec}
!insertmacro UnselectSection ${DCM64Sec}
!insertmacro SetSectionFlag ${DCM32Sec} ${SF_RO}
!insertmacro SetSectionFlag ${DCM64Sec} ${SF_RO}

${else}
!insertmacro ClearSectionFlag ${DCM32Sec} ${SF_RO}
!insertmacro ClearSectionFlag ${DCM64Sec} ${SF_RO}

${EndIf}


FunctionEnd