简体   繁体   中英

Is there any answer in NSIS?

Could you tell me how to do like "MUI_LICENSEPAGE_CHECKBOX" on Welcome page?

And I do control event when I clicked checkbox.

From the MUI documentation:

Page Custom Functions

... the show function is called, which can be used to customize the interface.

You can add extra controls in this callback. For MUIv2, that means nsDialogs:

!include LogicLib.nsh
!include MUI2.nsh
!define MUI_PAGE_CUSTOMFUNCTION_SHOW WelcomeShow
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE WelcomeLeave
!insertmacro MUI_PAGE_WELCOME
!define MUI_PAGE_CUSTOMFUNCTION_PRE LicensePre
!insertmacro MUI_PAGE_LICENSE "${__FILE__}"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE English

Var SkipLicensePage

Function WelcomeShow
${NSD_CreateCheckBox} 120u 150u 90% 12u "Accept license"
Pop $0
SetCtlColors $0 ${MUI_TEXTCOLOR} ${MUI_BGCOLOR}
System::Call 'USER32::SetWindowPos(p$0,p0,i0,i0,i0,i0,i0x33|0x40)' ; Force on top of the existing label
${NSD_SetState} $0 $SkipLicensePage
${NSD_OnClick} $0 WelcomeCheckClicked
FunctionEnd

Function WelcomeLeave
${NSD_GetState} $0 $SkipLicensePage
FunctionEnd

Function WelcomeCheckClicked
Pop $1 ; Throw away
MessageBox mb_ok "You clicked me!"
FunctionEnd

Function LicensePre
${IfThen} $SkipLicensePage <> 0 ${|} Abort ${|}
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