Archive: SelectSection/unSelectSection mess up all sections


SelectSection/unSelectSection mess up all sections


outfile `test.exe`
!include 'MUI.nsh'
!include 'LogicLib.nsh'

!define LOGICLIB_SECTIONCMP
!insertmacro MUI_PAGE_COMPONENTS


Function .OnInit
!insertmacro UnSelectSection ${a}
FunctionEnd

SectionGroup `!Parent` pnt

Section '!aaaa' a

SectionEnd

Section '!bbbb'

SectionEnd

Section '!cccc'

SectionEnd

SectionGroupEnd


As you guys see, The "aaaa" section is deselected in .OnInit function, so by default, the others should remain selected. But why in the world all sections become unselected???

How to resolve this issue?

The function .onInit should be moved after the sections. The section index ${a} is not defined until the sections are compiled, and it apparently gets a zero value, which matches all of your sections.

Don


Thanks, demiller9.

Another question,see the following code


outfile `test.exe`
!include 'MUI.nsh'
!include 'LogicLib.nsh'

!define LOGICLIB_SECTIONCMP
!insertmacro MUI_PAGE_COMPONENTS




SectionGroup `!Parent` pnt

Section '!aaaa' a

SectionEnd

Section '!bbbb' b

SectionEnd

Section '!cccc' c

SectionEnd

SectionGroupEnd

Function .OnInit
${For} $0 ${a} ${b}
!insertmacro ClearSectionFlag $0 ${SF_BOLD}
!insertmacro ClearSectionFlag ${pnt} ${SF_BOLD}
${Next}

${For} $0 ${a} ${c}
!insertmacro UnSelectSection $0
${Next}
FunctionEnd


In this case, why does unSelectSection not work?