简体   繁体   中英

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?

  1. Inspect some attribute to determine the install type and suppress call to nsDialogs::Show ? No idea what attribute to look for
  2. Some logic in the page routing that avoids the page being hit? No idea how to do this
  3. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM