简体   繁体   English

自定义现有的 NSIS MUI2 页面

[英]Customizing an exsisting NSIS MUI2 page

I have added a checkbox successfully to nsis installer's finish page defining functions for MUI_PAGE_CUSTOMFUNCTION_PRE and MUI_PAGE_CUSTOMFUNCTION_SHOW in finish page using MUI .我已经在 nsis 安装程序的完成页面中成功添加了一个复选框,使用MUI在完成页面中为MUI_PAGE_CUSTOMFUNCTION_PREMUI_PAGE_CUSTOMFUNCTION_SHOW定义函数。

But if I include MUI2 instead of MUI , the check box is not displayed.但是,如果我包含MUI2而不是MUI ,则不会显示该复选框。 I suppose there is something different in MUI2 than MUI with respect to this.我想在这方面MUI2MUI有一些不同。 I could not find documentation on that an if anyone knows that, can I please know???如果有人知道,我找不到有关该文件的文档,我可以知道吗???

Thank you谢谢

MUI1 uses InstallOptions for the Welcome and Finish pages and MUI2 uses nsDialogs. MUI1 将 InstallOptions 用于 Welcome 和 Finish 页面,MUI2 使用 nsDialogs。

This is documented in the MUI2 readme :这记录在MUI2 自述文件中:

The welcome and finish page are no longer implemented using InstallOptions.欢迎和完成页面不再使用 InstallOptions 实现。 Instead, the new nsDialogs plug-in is used.而是使用新的 nsDialogs 插件。 nsDialogs allows you to create custom pages or customize existing pages directly from the script. nsDialogs 允许您直接从脚本创建自定义页面或自定义现有页面。

Edit: Customize the page by using the nsDialogs commands in the show callback:编辑:使用 show 回调中的 nsDialogs 命令自定义页面:

var Checkbox

Function MyFinishShow
${NSD_CreateCheckbox} 120u 110u 100% 10u "&Something"
Pop $Checkbox
SetCtlColors $Checkbox "" "ffffff"
FunctionEnd

Function MyFinishLeave
${NSD_GetState} $Checkbox $0
${If} $0 <> 0
    MessageBox mb_ok "Custom checkbox was checked..."
${EndIf}
FunctionEnd

!define MUI_FINISHPAGE_RUN "calc.exe" ;See note after the code...
!define MUI_PAGE_CUSTOMFUNCTION_SHOW MyFinishShow
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE MyFinishLeave
!insertmacro MUI_PAGE_FINISH

Or if you are not using the existing finish page checkboxes, you can use those for custom stuff without using the show callback...或者,如果您没有使用现有的完成页面复选框,则可以将它们用于自定义内容,而无需使用 show 回调...

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

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