zjckwht
17th February 2007 19:22 UTC
Loop to deselect sections doesn't work
outfile `test.exe`
!include 'MUI.nsh'
!include 'LogicLib.nsh'
!define LOGICLIB_SECTIONCMP
!insertmacro MUI_PAGE_COMPONENTS
SectionGroup '!Parent' pnt
Section '!aaaa' aa
SectionEnd
Section '!bbbb' bb
SectionEnd
Section '!cccc' cc
SectionEnd
SectionGroupEnd
Function .OnInit
${For} $0 ${aa} ${cc}
!insertmacro UnSelectSection $0
${Next}
FunctionEnd
However if I change the .OnInit function content to the following, it works. Anybody knows why?
Function .OnInit
!insertmacro UnSelectSection ${aa}
!insertmacro UnSelectSection ${bb}
!insertmacro UnSelectSection ${cc}
FunctionEnd
demiller9
17th February 2007 19:34 UTC
Possibly a bug??
I've just been trying to figure this out for an hour or two since I read the other post you had on this question...
Your original code (the for loop) will work if you modify Sections.nsh. In that file change the $0 into $1 (including the push and pop) for the macro UnselectSection (lines 58 to 62).
Saving the registers before and after using them should make it indifferent to which register is used, but it doesn't seem to work with $0 as originally delivered!
Don
kichik
17th February 2007 19:35 UTC
The macros use $0 internally so it fails. Use $1 for now and submit a bug report so it'll be fixed for the next version.
demiller9
17th February 2007 19:56 UTC
Here's a simple script that displays the macro 'Section' argument before and after the macro calls SectionGetFlags. I copied the macro into the nsi file twice, one copy uses $1 and the other uses the original $0.
The SectionGetFlags instruction seems to destroy the ${SECTION} argument, even if that argument has a different name (ie, I tried modifying its name and it still gets destroyed).
Don
[edit] I see Kichik found a problem, so my test script is redundant. ;)
zjckwht
18th February 2007 04:38 UTC
Oh yes..this problem fixed.Thanks demiller9 and kichik.But now another problem found, see my new post "Modifying sectiongroup will make all its subsections restore default?"