简体   繁体   English

有人在组件MUI页面上选择组件时调用函数

[英]Call Function When Someone Selects a Component on the Component MUI Page

I am trying to add some custom functionality to the MUI2 Components Page. 我正在尝试向MUI2组件页面添加一些自定义功能。

When the user selects a Component(Checkbox) I want to call my custom function. 当用户选择一个组件(复选框)时,我想调用我的自定义函数。 If the 1st component has bee selected then I want to check/select the 2nd component also. 如果选择了第一个组件,那么我也要检查/选择第二个组件。

My code below attempts to code this functionality but I am getting compile errors: 我下面的代码尝试对该功能进行编码,但出现编译错误:

Error in macro __NSD_OnControlEvent on macroline 8 在第8行巨集__NSD_OnControlEvent中发生错误

!include nsdialogs.nsh
!include MUI2.nsh

!define MUI_PAGE_CUSTOMFUNCTION_SHOW compshow

!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"

OutFile "test.exe"

Function OnCustomisationComponentClick 
    #SendMessage 1032 ${TVM_SETITEM} 0 $someTVItem
    MessageBox MB_OK "abc"
FunctionEnd

Function compshow
    FindWindow $0 "#32770" "" $HWNDPARENT
    GetDlgItem $0 $0 1032 # 1032 is the Treeview that holds the components
    !insertmacro __NSD_OnControlEvent ${TVM_SELECTITEM} $0 OnCustomisationComponentClick
FunctionEnd


Section "Dummy"

SectionEnd

NSDialogs macros only work on NSDialog pages, the component page is a native NSIS page. NSDialogs宏仅在NSDialog页面上起作用,组件页面是本机NSIS页面。

You must use the .onSelChange callback function to handle changes (Use the helper macros in sections.nsh) 您必须使用.onSelChange回调函数来处理更改(使用sections.nsh中的帮助程序宏)

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

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