Archive: problem with "section index"


problem with "section index"
I have a section definition in the following fashion: 'Section /o "MySection" setSmth'. The section is within a SectionGroup (just in case it could affect my problem). When I try to do 'SectionGetFlags ${setSmth} $0', ${setSmth} is undefined (even compiler complaints about the fact). However, when I try to do 'SectionGetFlags 17 $0' (with '17' being the section index that I counted by hand), everything works. What's wrong?


I tried to test it and all works.

Where are you use SectionGetFlags (inside section, function or ...)?


${setSmth} will be defined as the compiler reaches that line. So naturally, if you try and use the ${setSmth} define before the Section call then it will not have been defined yet.

-Stu


Yes, that's true, my Section definition is after I refer to the variable into which its index is put, i.e. ${setSmth}. But NSIS installer is not sequential really, so I thought it does not matter where you define section and where you refer to its index. I actually tried to use this undefined section index within .onSelChange function. Anyway, I fixed everything by simply moving .onSelChange function definition at the end of the script


The preprocessor is sequential and a define is a preprocessor "variable".