Skip to content
⌘ NSIS Forum Archive

Call function when a Component is selected

2 posts

gretty#

Call function when a Component is selected

Hello

I am trying to add some custom functionality to the MUI2 Components Page.

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
!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