[英]Calling PRE functions of MUI in NSIS installer, skipping pages/dialogs in NSIS installer
Can PRE function of a MUI dialog be called only when required?是否可以仅在需要时调用 MUI 对话框的 PRE function?
!define MUI_PAGE_CUSTOMFUNCTION_PRE SkipComponentsPage
!insertmacro MUI_PAGE_COMPONENTS
Function SkipComponentsPage
Abort
MessageBox MB_OK "You chose to UPDATE your current version"
FunctionEnd
//This section will be checked by default, that is, user will not be able to select or unselect this section, this has to be executed..........how to do this?To hide it, i have included a - sign in its name. //默认勾选此部分,即用户将无法选择 select 或取消选择此部分,这必须执行..........怎么做?隐藏它,我在其名称中包含一个 - 符号。 its name is "mandatory"
它的名字是“强制性的”
Section "-mandatory" SEC_UPDATE
#Do update............
SectionEnd
I have two RadioButtons (Demo & Update) on my custom dialog page in the NSIS installer.我在 NSIS 安装程序的自定义对话框页面上有两个 RadioButton(演示和更新)。 I want that when the user choses to install the UPDATE (choses the UPDATE RadioButton), then the Components Page is skipped, and a specified Section is auto CHECKED and executed.
我希望当用户选择安装更新(选择更新单选按钮)时,跳过组件页面,并自动检查并执行指定的部分。
But if the user choses to install the DEM (choses the DEMO RadioButton), then the Components page is not skipped & the user can Check or Uncheck Sections on that Component page.但是,如果用户选择安装 DEM(选择 DEMO 单选按钮),则不会跳过组件页面,并且用户可以在该组件页面上选中或取消选中部分。
A page callback is always called, but you can put logic inside the function:始终调用页面回调,但您可以将逻辑放入 function 中:
...
section "" SEC_UPDATE
sectionend
Function SkipComponentsPage
!insertmacro UnSelectSection ${SEC_UPDATE} ; Don't include update with demo by default?
${If} $InstallType == UPDATE
!insertmacro SelectSection ${SEC_UPDATE}
Abort
${EndIf}
Functionend
It is not really clear to me if you want the user to be able to choose update in the demo mode, but if you want to force the update you can make the section read only:我不清楚您是否希望用户能够在演示模式下选择更新,但如果您想强制更新,您可以将该部分设为只读:
section "Update" SEC_UPDATE
SectionIn RO
sectionend
(And remove the UnSelectSection call from the pre function) (并从 pre 函数中删除 UnSelectSection 调用)
...or just make the section invisible with the -name prefix like you suggested. ...或者只是像您建议的那样使用 -name 前缀使该部分不可见。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.