ShadowElf Posted February 3, 2010 Share Posted February 3, 2010 I have a list when I click on a item i want to execute a function. How to do that? thx I like IT: php, mysql, codeingiter, css, jquery and AUTOIT Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 3, 2010 Moderators Share Posted February 3, 2010 ShadowElf,Just look for it in your GUIGetMsg loop: #include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) $hList = GUICtrlCreateList("", 10, 10, 480, 200) GUICtrlSetData($hList, "One|Two|Three|Four|Five|Six|Seven|Eight|Nine|Ten") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hList _My_Func() EndSwitch WEnd Func _My_Func() MsgBox(0, "List Item", GUICtrlRead($hList) & " clicked") EndFuncM23 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 Link to comment Share on other sites More sharing options...
JoeBar Posted November 5, 2019 Share Posted November 5, 2019 Hi, sorry to excavate the topic, but when we want to capture a doubleclick on an item, what's the difference in the code ? Link to comment Share on other sites More sharing options...
Nine Posted November 5, 2019 Share Posted November 5, 2019 Look at the example for _GUICtrlListView_Create. It clearly shows how to capture a double click event. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
JoeBar Posted November 5, 2019 Share Posted November 5, 2019 (edited) I was talking about items in List (not ListView). I have another question, Is there an event for when an item is selectionned (either by click or arrows) ? Edited November 5, 2019 by JoeBar Link to comment Share on other sites More sharing options...
Zedna Posted November 5, 2019 Share Posted November 5, 2019 expandcollapse popup#include <GUIConstants.au3> #NoTrayIcon ;~ Global Const $WM_COMMAND = 0x0111 ;~ Global Const $LBN_SELCHANGE = 1 ;~ Global Const $LBN_DBLCLK = 2 $Form2 = GUICreate("Menu", 300, 300, 302, 218, -1, $WS_EX_TOPMOST) ;GUISetIcon("C:\Documenti\Icone\cvbxbd.ico") $GCCList = GUICtrlCreateList("", 10, 10, 220, 300) $Label1 = GUICtrlCreateLabel("Menu", 20, 32, 140, 30) ;GUICtrlSetFont(-1, 20, 400, 0, "Century Gothic") GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND") GUISetState(@SW_SHOW) poplist() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case _IsPressed('0D') And ControlGetFocus($Form2) = 'ListBox1' If GUICtrlRead($GCCList) Then Run("rundll32 shell32,Control_RunDLL " & GUICtrlRead($GCCList)) Sleep(10); Delay not to run multiple copies EndIf Exit EndSelect WEnd Func MY_WM_COMMAND($hWnd, $msg, $wParam, $lParam) $nNotifyCode = BitShift($wParam, 16) $nID = BitAND($wParam, 0x0000FFFF) $hCtrl = $lParam If $nID = $GCCList Then Switch $nNotifyCode Case $LBN_DBLCLK If GUICtrlRead($GCCList) Then Run("rundll32 shell32,Control_RunDLL " & GUICtrlRead($GCCList)) EndIf Exit Return 0 EndSwitch EndIf EndFunc ;==>MY_WM_COMMAND Func _IsPressed($s_hexKey, $v_dll = 'user32.dll') Local $a_R = DllCall($v_dll, "int", "GetAsyncKeyState", "int", '0x' & $s_hexKey) If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Return 1 Return 0 EndFunc ;==>_IsPressed Func Runcpl() ;Run (@Comspec & " /c start " &GUICtrlRead($GCCList)) Run("rundll32 shell32,Control_RunDLL " & GUICtrlRead($GCCList)) EndFunc ;==>Runcpl Func poplist() $search = FileFindFirstFile(@SystemDir & "\*.cpl") If @error Then Return While 1 $file = FileFindNextFile($search) If @error Then Return GUICtrlSetData($GCCList, $file) WEnd EndFunc ;==>poplist Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
JoeBar Posted November 5, 2019 Share Posted November 5, 2019 @Zedna Very interesting, thank you. So for the Lists, we must create a WM_COMMAND , while for other controls (ListView) it's integrated. Link to comment Share on other sites More sharing options...
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