简体   繁体   中英

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

I've built a simple installer on Windows using NSIS 2.46. 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:

!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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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