简体   繁体   English

NSIS安装程序的“许可证”页面仅显示“关闭”和“取消”按钮

[英]NSIS installer License page only shows “Close” and “Cancel” buttons

I've built a simple installer on Windows using NSIS 2.46. 我已经使用NSIS 2.46在Windows上构建了一个简单的安装程序。 That is the code for the license page 那是许可证页面的代码

# UI
!include "MUI2.nsh"
!define MUI_LICENSEPAGE_RADIOBUTTONS
!insertmacro MUI_PAGE_LICENSE "..\legal\disclaimer.txt"
!insertmacro MUI_LANGUAGE "English"

When I run the installer, the License page displays the license text properly but only has a disabled "Close" and an enabled "Cancel" button. 当我运行安装程序时,“许可证”页面会正确显示许可证文本,但只有禁用的“关闭”和启用的“取消”按钮。 Once I change the selected radio button to "I accept the terms of the License Agreement", the "Close" button is enabled. 一旦我将选定的单选按钮更改为“我接受许可协议的条款”,便会启用“关闭”按钮。 Both buttons cause the installer to quit if I click them. 如果我单击它们,这两个按钮都会导致安装程序退出。

How can I change the script to have a "Continue" button if the license is accepted? 如果许可证被接受,如何将脚本更改为具有“继续”按钮?

Having a installer with just a license page is rather pointless, everything should behave normally if you add another page after it: 仅具有许可证页面的安装程序是毫无意义的,如果在其后添加另一个页面,则一切都应正常运行:

!include "MUI2.nsh"
!define MUI_LICENSEPAGE_RADIOBUTTONS
!insertmacro MUI_PAGE_LICENSE "${__FILE__}"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"

It is not recommended to create a installer without a InstFiles page but it can be done: 不建议创建没有InstFiles页面的安装程序,但可以这样做:

!include "MUI2.nsh"
!define MUI_LICENSEPAGE_RADIOBUTTONS
!define MUI_PAGE_CUSTOMFUNCTION_SHOW SetNextBtnTextToInstall
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE DoInstall
!insertmacro MUI_PAGE_LICENSE "${__FILE__}"
!insertmacro MUI_LANGUAGE "English"

Function SetNextBtnTextToInstall
GetDlgItem $0 $hwndparent 1
${NSD_SetText} $0 "$(^InstallBtn)"
FunctionEnd

Function DoInstall
MessageBox mb_ok "Install would take place here..."
SetErrorLevel 0
Quit
FunctionEnd

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

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