简体   繁体   English

使用nsDialog在NSIS中有条件地显示页面

[英]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. 我已经使用nsDialogs为我的安装程序添加了一个自定义页面,但是,该页面只需要显示给我的一个InstType选项。

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 ? 检查一些属性以确定安装类型并禁止调用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. 跳过页面 ,请在该页面的create function callback中调用abort。

!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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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