Conditional Display of pages in NSIS using nsDialog
I have added a custom page to my installer created using nsDialogs, however, the page is only necessary to be displayed to one of my InstType options.
InstType "Default" # 1
InstType "Developer" # 2
In the example above, I'd like the extra page to be shown to only developers. What is the best practice?
- Inspect some attribute to determine the 开发者_JAVA百科install type and suppress call to
nsDialogs::Show
? No idea what attribute to look for - Some logic in the page routing that avoids the page being hit? No idea how to do this
- Something else?
To skip a page, call abort in the create function callback for that page.
!include LogicLib.nsh
InstType "Normal"
InstType "Developer"
Page Components
Page Custom myDevPage
;Page start menu etc...
Page InstFiles
Section /o "" ${SEC_Dev}
;This (hidden) section is used just to check the insttype state, but you could also use it to install dev specific files etc
SectionIn 2
Sectionend
Function myDevPage
${IfNot} ${SectionIsSelected} ${SEC_Dev}
Abort
${EndIf}
;nsDialog code goes here
FunctionEnd
精彩评论