rajeshwaran Posted August 30, 2010 Posted August 30, 2010 I have created a List Box, when a item was double clicked, I have to perform some actions, so I want to set a event handler for List Box double click. I have configured a Event Handler for List Box, but I dont know, how to identify the double click action performed on the List Box. Please help me.
Moderators Melba23 Posted August 30, 2010 Moderators Posted August 30, 2010 rajeshwaran, What have you got in your handler so far? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
rajeshwaran Posted August 30, 2010 Author Posted August 30, 2010 Handler called for Single Click also, I cant able to differentiate single click and double click Please help me
rajeshwaran Posted August 30, 2010 Author Posted August 30, 2010 (edited) I got a solution. For ListBox double click notification, refer the example of user defined function "_GUICtrlListBox_Create" in AutoIt help Edited August 30, 2010 by rajeshwaran
Moderators Melba23 Posted August 30, 2010 Moderators Posted August 30, 2010 (edited) rajeshwaran, Then you will not need this: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ListBoxConstants.au3> #include <StructureConstants.au3> $hGUI = GUICreate("Test", 500, 500) $hListBox = GUICtrlCreateList("", 10, 10, 200, 200) $hWndListBox = GUICtrlGetHandle($hListBox) GUICtrlSetData($hListBox, "1|2|3|4") GUISetState() GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") $fAction = 0 $sLastSel = "" While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch If GUICtrlRead($hListBox) <> $sLastSel Then $sLastSel = GUICtrlRead($hListBox) ; Wait to see if there is a double click Sleep(150) If $fAction = 1 Then MsgBox(0, "", "Listbox Double Click") Else MsgBox(0, "", "Listbox Single Click") EndIf $fAction = 0 Else If $fAction = 1 Then MsgBox(0, "", "Listbox Double Click") $fAction = 0 EndIf EndIf WEnd Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = $lParam $iCode = BitShift($wParam, 16) ; Hi Word Switch $hWndFrom Case $hWndListBox Switch $iCode Case $LBN_DBLCLK ; Sent when the user double-clicks a string in a list box $fAction = 1 EndSwitch EndSwitch EndFunc M23 Edit: Added a missing include. Edited September 9, 2010 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
rajeshwaran Posted August 30, 2010 Author Posted August 30, 2010 Hi Melba, Thank you very much for your post. I understood the concept. Can you help me, where to find the complete list of messages like "$LBN_DBLCLK", I cant find in AutoIt help.
Moderators Melba23 Posted August 30, 2010 Moderators Posted August 30, 2010 rajeshwaran,You need to look here and see what messages are sent by each type of control. Once you have found the message code, search the forum for a handler - there is usually one available. If not, then write your own! Have fun! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
fly Posted September 9, 2010 Posted September 9, 2010 Hopefully its okay that I bump this thread... rajeshwaran, Then you will not need this: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ListBoxConstants.au3> $hGUI = GUICreate("Test", 500, 500) $hListBox = GUICtrlCreateList("", 10, 10, 200, 200) $hWndListBox = GUICtrlGetHandle($hListBox) GUICtrlSetData($hListBox, "1|2|3|4") GUISetState() GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") $fAction = 0 $sLastSel = "" While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch If GUICtrlRead($hListBox) <> $sLastSel Then $sLastSel = GUICtrlRead($hListBox) ; Wait to see if there is a double click Sleep(150) If $fAction = 1 Then MsgBox(0, "", "Listbox Double Click") Else MsgBox(0, "", "Listbox Single Click") EndIf $fAction = 0 Else If $fAction = 1 Then MsgBox(0, "", "Listbox Double Click") $fAction = 0 EndIf EndIf WEnd Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = $lParam $iCode = BitShift($wParam, 16) ; Hi Word Switch $hWndFrom Case $hWndListBox Switch $iCode Case $LBN_DBLCLK ; Sent when the user double-clicks a string in a list box $fAction = 1 EndSwitch EndSwitch EndFunc M23 I had the exact same question about how to capture a listbox double click. I tried the above code, just to see if it would work and I get an error. I'm wondering if someone could show me the light... C:\Users\Me\Documents\My Dropbox\Scripts\RAsL\test.au3(49,46) : WARNING: $tagNMHDR: possibly used before declaration. Local $tNMHDR = DllStructCreate($tagNMHDR, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Me\Documents\My Dropbox\Scripts\RAsL\test.au3(49,46) : ERROR: $tagNMHDR: undeclared global variable. Local $tNMHDR = DllStructCreate($tagNMHDR, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\me\Documents\My Dropbox\Scripts\RAsL\test.au3 - 1 error(s), 1 warning(s)
Moderators Melba23 Posted September 9, 2010 Moderators Posted September 9, 2010 fly,Add #include <StructureConstants.au3>. Sorry about that! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
fly Posted September 9, 2010 Posted September 9, 2010 fly,Add #include <StructureConstants.au3>. Sorry about that! M23Wow, that was fast. Got it now. Thanks!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now