简体   繁体   English

在 NSIS 安装程序中调用 MUI 的 PRE 函数,在 NSIS 安装程序中跳过页面/对话框

[英]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.

相关问题 设置在 nsis 安装程序的自定义对话框页面上添加的自定义 label 的字体 - set the font of a custom label added on a custom dialog page in nsis installer NSIS-使用命令行参数跳过某些对话框吗? - NSIS - Skip certain dialogs using command-line arguments? 如何更改 NSIS 中欢迎页面和完成页面中图像的宽度,使其看起来像背景? - How can I change the width of the image in the welcome and finish pages in NSIS so that it will look like a background? NSIS 为卸载程序使用选定的语言 - NSIS Use selected language for uninstaller 如何更改 NSIS 中字幕的字体? - How can I change the font of the captions in NSIS? 在NSIS中,如何在运行时将onClick事件应用于对话框控件? - In NSIS, how to apply a onClick event on a dialog control at runtime? 如何在nsis的ABORT消息框中禁用关闭按钮? - How to disable close button in the ABORT Message box in nsis? Windows Installer工具包(WIX)对话框条件不起作用 - Windows Installer Toolkit (WIX) Dialog Condition not working NSIS:单击“下一步” /“后​​退”按钮后,如何保持上一个对话框的输入值? - NSIS : How to keep input value from previous dialog after click Next/Back button? 在自定义用户界面中找不到IDOK(1)! 如何在NSIS中添加自定义“确定”按钮? - Can't find IDOK (1) in the custom UI! How to add a custom OK Button in NSIS?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM