NSIS:StateChanged上的自定义页面

时间:2017-08-17 11:24:49

标签: installer nsis

我有一些不同的许可证页面,上面有复选框。如果未选中复选框,则应禁用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 按钮。如果复选框状态发生变化,是否有可以使用的事件?这是我的其中一个

的代码
public static void DeleteDataItemOfType(this DynamicModuleManager manager, string type, Guid Id)
    {
        Type resolvedType = TypeResolutionService.ResolveType(type);

        using (var region = new ElevatedModeRegion(manager))
        {
            manager.DeleteDataItem(resolvedType, Id);

            manager.SaveChanges();
        }
    }

1 个答案:

答案 0 :(得分:1)

内置的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