I have the following structure in my installer:
In a separate file called Dialogs.nsi, I have defined some functions that display custom pages. These pages are only to be displayed if a certain section is selected. In order to do this, I use something like this:Section /o "Automatic Drive Partitioning" SEC_PART
${myLogText} "**** Automatic Drive Partitioning ****"
Call startPartitioner
Call readPartitionerLog
SectionEnd
Section /o "Modify Windows Settings" SEC_WIN
${myLogText} "**** Windows Settings Configuration ****"
Call instWin
SectionEnd
Thus, if section SEC_WIN is selected, I would see the function that starts with the above code.Function preWin
SectionGetFlags 1 $R0
IntOp $R0 $R0 & ${SF_SELECTED}
IntCmp $R0 ${SF_SELECTED} show
Abort
show:
...
FunctionEnd
My "problem" is that if I have to add a new section and I want it to appear before an existing one, I would have to modify my Dialogs.nsi every time to update the section index.
In order to avoid this, I tried using the section ID instead of the index, as such:
Problem is, when I do this, I get a compile error stating that:Function preWin
SectionGetFlags ${SEC_WIN} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
IntCmp $R0 ${SF_SELECTED} show
Abort
show:
...
FunctionEnd
warning: unknown variable/constant "{SEC_VID}" detected, ignoring (Dialogs.nsi:50)
Usage: SectionGetFlags section_index $(user_var: output flags)
I suppose this is because the Dialogs.nsi file is included before my sections are defined and as such, the variables ${SEC_WIN}, etc. don't exist yet. Is there any way to avoid using the section index numbers and use the identifiers instead?
Thanks,
Mircea