Archive: Trapping Double clicks on ListBox ?


Trapping Double clicks on ListBox ?
Hi all,

Is there any way to trap a Double click on a Listbox?

I can trap a "Selection Change" with the "VERIFY" flag,
but I am unsure how to trap a double click on an item in said Listbox...

Specifically, the MS URL:
http://msdn.microsoft.com/library/de.../listboxes.asp


This is the notice/trap that I need to catch:


Notifications
LBN_DBLCLK
An application sends the LBN_DBLCLK notification message when the user double-clicks a string in a list box. The parent window of the list box receives this notification message through the WM_COMMAND message.



Thanks all!
Scott


It's NOTIFY flag not VERIFY :)
No matter single or double click, it's up to your code on leave function the action that should be performed, for instance you trap that the listbox caused the notification, you read users selection, then perform some actions and last add abort which means you don't leave the page, or don't add abort which means you go to the next action/step or page at once.


Hi RedWine,

Thanks for the response!

(I am *very* impressed at how many threads you respond to!
You are very helpful, and I know I appreciate your time immensely!)

The problem is that there is no way for me to detect
in the NOTIFY section the actual event that triggered the notify.

Specifically, whether the user changed the selected item in the list (ONSELCHANGE) or whether they double clicked on an item (ONDBLCLICK)

However, the InstallOptionsEx *can* report the different types of events back to me.
Which is exactly what I need!

Thanks again for your response!
I am still new to NSIS, and let me tell you, I am reading just about every thread you have responded to! =)

Scott


Thanks!
Definitely IOex has more abilities than IO :)
Although you found your way through IOex allow me to explain what you may do with IO, and let me know plz if I got it right and this is what you're looking for.

OutFile "Test.exe"

!include "mui.nsh"

!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
Page Custom custcreate custleave
!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_LANGUAGE "English"

Section

SectionEnd


Function custcreate
!insertmacro MUI_HEADER_TEXT "Custom Page" \
"Just a simple custom page"
!insertmacro MUI_INSTALLOPTIONS_WRITE "custom.ini" "field 1" "state" "some sample text"
push $0
InstallOptions::Dialog "$PLUGINSDIR\custom.ini"
pop $0
pop $0
FunctionEnd


Function custleave
!insertmacro MUI_INSTALLOPTIONS_READ $0 "custom.ini" "Settings" "state"
StrCmp $0 1 0 next
!insertmacro MUI_INSTALLOPTIONS_READ $0 "custom.ini" "field 1" "State"
MessageBox MB_OK "Your selection is $0.$\r$\n\
Now we can set up actions regarding to $0$\r$\n\
and STAY TO THIS PAGE waiting for other action."
Abort

next:
StrCmp $0 2 0 end
!insertmacro MUI_INSTALLOPTIONS_READ $0 "custom.ini" "field 2" "State"
MessageBox MB_OK "Your selection is $0.$\r$\n\
Now we can set up actions regarding to $0$\r$\n\
and LEAVE THIS PAGE going to next page at once."

end:
FunctionEnd


Function .onInit
InitPluginsDir
GetTempFileName $0
Rename $0 "$PLUGINSDIR\custom.ini"

WriteINIStr "$PLUGINSDIR\custom.ini" "settings" "numfields" "2"

WriteINIStr "$PLUGINSDIR\custom.ini" "field 1" "type" "ListBox"
WriteINIStr "$PLUGINSDIR\custom.ini" "field 1" "left" "10"
WriteINIStr "$PLUGINSDIR\custom.ini" "field 1" "right" "-10"
WriteINIStr "$PLUGINSDIR\custom.ini" "field 1" "top" "20"
WriteINIStr "$PLUGINSDIR\custom.ini" "field 1" "bottom" "52"
WriteINIStr "$PLUGINSDIR\custom.ini" "field 1" "ListItems" "A|B|C"
WriteINIStr "$PLUGINSDIR\custom.ini" "field 1" "flags" "NOTIFY"

WriteINIStr "$PLUGINSDIR\custom.ini" "field 2" "type" "ListBox"
WriteINIStr "$PLUGINSDIR\custom.ini" "field 2" "left" "10"
WriteINIStr "$PLUGINSDIR\custom.ini" "field 2" "right" "-10"
WriteINIStr "$PLUGINSDIR\custom.ini" "field 2" "top" "80"
WriteINIStr "$PLUGINSDIR\custom.ini" "field 2" "bottom" "112"
WriteINIStr "$PLUGINSDIR\custom.ini" "field 2" "ListItems" "X|Y|Z"
WriteINIStr "$PLUGINSDIR\custom.ini" "field 2" "flags" "NOTIFY"
FunctionEnd