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

时间:2010-08-05 11:42:53

标签: nsis nsdialogs

我已经为使用nsDialogs创建的安装程序添加了一个自定义页面,但是,只需要将页面显示给我的一个InstType选项。

InstType "Default" # 1
InstType "Developer" # 2

在上面的示例中,我希望仅向开发人员显示额外页面。什么是最佳做法?

  1. 检查某个属性以确定安装类型并禁止调用nsDialogs::Show不知道要查找的属性
  2. 页面路由中的一些逻辑可以避免页面被点击? 不知道如何做到这一点
  3. 别的什么?

1 个答案:

答案 0 :(得分:4)

skip a 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