DoubleClick (ListBox)
Hello there!
Whenever a user DoubleClicks an entry in a ListBox I am trying to call a function.
Searching the documentation and this forum did not help me: found nothing concerning DoubleClicks ...
I tried intercepting LBN_DBLCLK (--> http://msdn.microsoft.com/en-us/library/ms997541.aspx) with NSD_OnNotify but it never fires ...
(NSD_OnClick is not working for me either ...)
At the moment I am using NSD_OnChange to simulate a very slow and bad 'Double'Click.
Is there any way to call a function if someone doubleclicks an entry in a ListBox?
(... Am I doing something stupid?)
;--------------------------------
NSD_CreateListBox} 30% 0 40% 60% ""
;Include
!include "MUI2.nsh"
!include "nsDialogs.nsh"
>;--------------------------------
;General
>!define VERSION "0.1.1"
>Name "LB DoubleClick Test"
>OutFile "LB_DoubleClick_Test.exe"
>RequestExecutionLevel user
>;--------------------------------
;Variables
Var LB_test
Var CurrentString
>;--------------------------------
;Pages
Page custom nsDialogsMain
>;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
>;--------------------------------
;Descriptions
;Header
LangString"^SetupCaption" ${LANG_ENGLISH} "$(^Name) v${VERSION}"
LangString PAGEMAIN_TITLE ${LANG_ENGLISH} "ListBox DoubleClick Test"
LangString PAGEMAIN_SUBTITLE ${LANG_ENGLISH} "Does a DoubleClick even work ?"
>;--------------------------------
;Makros
;select (first, second, third ... last) item of a ListBox
!macro _NSD_LB_SelectItem CONTROL ITEM
SendMessage${CONTROL} ${LB_SETCURSEL} ${ITEM} 0
!macroend
!define NSD_LB_SelectItem "!insertmacro _NSD_LB_SelectItem"
>;--------------------------------
;Installer Sections
Section ""
>SectionEnd
>;--------------------------------
;Installer Functions
>;PagesAndExitFunctions - START
>Function nsDialogsMain
!insertmacro MUI_HEADER_TEXT $(PAGEMAIN_TITLE) $(PAGEMAIN_SUBTITLE)
nsDialogs::Create 1018
Pop$0
${If} $0 == error
Abort
${EndIf}
${
Pop $LB_test
${NSD_OnNotify} $LB_test func_OnNotify
${NSD_OnClick} $LB_test func_OnClick
${NSD_OnChange} $LB_test func_OnChange
Call func_fillListBox
nsDialogs::Show
FunctionEnd
>;PagesAndExitFunctions - END
>Function func_fillListBox
${NSD_LB_Clear} $LB_test $0
${NSD_LB_AddString} $LB_test "testString1"
${NSD_LB_AddString} $LB_test "testString2"
${NSD_LB_AddString} $LB_test "testString3"
;select first item in ListBox
${NSD_LB_SelectItem} $LB_test 0
FunctionEnd
>;this will never fire ...
Function func_OnNotify
${NSD_LB_GetSelection} $LB_test $CurrentString
MessageBox MB_OK "$CurrentString:$\r$\nfunc_OnNotify fired ..."
; for func_OnChange:
StrCpy $CurrentString ""
>FunctionEnd
>;this will never fire ...
Function func_OnClick
${NSD_LB_GetSelection} $LB_test $CurrentString
MessageBox MB_OK "$CurrentString:$\r$\nfunc_OnClick fired ..."
; for func_OnChange:
StrCpy $CurrentString ""
>FunctionEnd
>Function func_OnChange
;it fires even if clicked twice(slowly) on an empty field of ListBox ...
;just to imitate a very slow double click 1/2:
${NSD_LB_GetSelection} $LB_test $0
StrCmp"$CurrentString" "$0" +3 0
StrCpy $CurrentString$0
Abort ###
MessageBox MB_OK "$CurrentString:$\r$\nfunc_OnChange fired ..."
; just to imitate a very slow double click 2/2:
StrCpy "$CurrentString" ""
>FunctionEnd
>