简体   繁体   English

NSIS:StateChanged上的自定义页面

[英]NSIS: Custom page on StateChanged

I have a some different license pages with check box on it. 我有一些带有复选框的不同许可证页面。 The Next button should be disabled if check box is unchecked. 如果未选中该复选框,则应禁用“ Next按钮。 Is there an event that I can use if checkbox state changed? 如果复选框状态更改,是否可以使用一个事件? Here is my code of one of this 这是我的其中之一的代码

var Window
var labelDescription
var checkBoxIsUserAgree

Function CreateCustomLicense1
  nsDialogs::Create 1018
  Pop $Window

  GetDlgItem $0 $HWNDPARENT
  EnableWindow $0 0
  ${NSD_CreateLabel} 13u 22u 270u 96u "Description"
  Pop $labelDescription
  ${NSD_CreateCheckBox} 10u 110u 100u 15u "I Agree"
  $checkBoxIsUserAgree
FunctionEnd

Function ShowCustomLicence1
  Call CreateCustomLicense1
  nsDialogs::Show
Function

Function .oncheckBoxIsUserAgreeStateChanged ; what event I can use for track checkbox state changing
 EnableWindow $0 1
FunctionEnd

The built-in NSIS license page supports a checkbox and can be used multiple times but if you insist on creating a custom page you just have to add a on* handler: 内置的NSIS许可证页面支持一个复选框,可以多次使用,但是如果您坚持创建自定义页面,则只需添加on *处理程序即可:

!include nsDialogs.nsh

Var checkBoxIsUserAgree

Function ShowCustomLicence1
  nsDialogs::Create 1018
  Pop $1

  GetDlgItem $0 $HWNDPARENT 1
  EnableWindow $0 0
  ${NSD_CreateLabel} 13u 22u 270u 90u "Description"
  Pop $1
  ${NSD_CreateCheckBox} 10u 110u 100u 15u "I Agree"
  Pop $checkBoxIsUserAgree
  ${NSD_OnClick} $checkBoxIsUserAgree oncheckBoxIsUserAgreeStateChanged1

  nsDialogs::Show
FunctionEnd


Function oncheckBoxIsUserAgreeStateChanged1
  Pop $1 ; Throw away parameter
  ${NSD_GetState} $checkBoxIsUserAgree $1
  EnableWindow $0 $1
FunctionEnd

Page Custom ShowCustomLicence1
Page InstFiles

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

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