Prev Previous Post   Next Post Next
Old 21st September 2015, 10:20   #1
Mircea M
Junior Member
 
Join Date: Aug 2014
Posts: 44
Question about SectionGetFlags

Hi,

I have the following structure in my installer:

code:
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



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:

code:
Function preWin
SectionGetFlags 1 $R0
IntOp $R0 $R0 & ${SF_SELECTED}
IntCmp $R0 ${SF_SELECTED} show

Abort

show:
...
FunctionEnd



Thus, if section SEC_WIN is selected, I would see the function that starts with the above code.

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:

code:
Function preWin
SectionGetFlags ${SEC_WIN} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
IntCmp $R0 ${SF_SELECTED} show

Abort

show:
...
FunctionEnd



Problem is, when I do this, I get a compile error stating that:
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
Mircea M is offline   Reply With Quote
 
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump