water Posted August 20, 2008 Posted August 20, 2008 Hi Gurus, I use the following code to catch a double klick on a listbox entry. is it possible to use the same method to catch the return key? Thanks in advance GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg Local $hWndFrom, $iIDFrom, $iCode, $hWndList If Not IsHWnd($GUIUserList) Then $hWndList = GUICtrlGetHandle($GUIUserList) $hWndFrom = $ilParam $iIDFrom = BitAND($iwParam, 0xFFFF); Low Word $iCode = BitShift($iwParam, 16); Hi Word Switch $hWndFrom Case $GUIUserList, $hWndList Switch $iCode Case $LBN_DBLCLK; Sent when the user double-clicks a string in a list box ; Bringt Inhalt der ausgewählten Zeile "OrgEinheit - Name" $Selected = GUICtrlRead($GUIUserList) _GetGroupList() Case $LBN_KILLFOCUS; Sent when a list box loses the keyboard focus Case $LBN_SELCHANGE; Sent when the selection in a list box has changed GUICtrlSetData($GUIGroupList,"") GUICtrlSetData($GUIGroupLabel,$sGroupLabel) If Not $IB And Not $SingleUser Then GUICtrlSetData($GUIGroupUserList,"") GUICtrlSetData($GUIGroupUserLabel,$sGroupUserLabel) EndIf Case $LBN_SETFOCUS; Sent when a list box receives the keyboard focus EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
rasim Posted August 21, 2008 Posted August 21, 2008 waterExample:#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Test", 300, 200) $hListBox = GUICtrlCreateList("", 10, 10, 280, 180) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam) If $wParam = 1 Then ConsoleWrite("!> Enter is pressed" & @LF) Return $GUI_RUNDEFMSG EndFunc
water Posted August 21, 2008 Author Posted August 21, 2008 Hi rasim, works great - thanks a lot! Thomas My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
water Posted August 21, 2008 Author Posted August 21, 2008 Hi rasim, works great - thanks a lot! Thomas My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
the123punch Posted September 15, 2008 Posted September 15, 2008 Switch $hWndFrom Case $GUIUserList, $hWndList Switch $iCode Case $LBN_DBLCLK; Sent when the user double-clicks a string in a list box ; Bringt Inhalt der ausgewählten Zeile "OrgEinheit - Name" $Selected = GUICtrlRead($GUIUserList) _GetGroupList() Case $LBN_KILLFOCUS; Sent when a list box loses the keyboard focus Case $LBN_SELCHANGE; Sent when the selection in a list box has changed GUICtrlSetData($GUIGroupList,"") GUICtrlSetData($GUIGroupLabel,$sGroupLabel) If Not $IB And Not $SingleUser Then GUICtrlSetData($GUIGroupUserList,"") GUICtrlSetData($GUIGroupUserLabel,$sGroupUserLabel) EndIf Case $LBN_SETFOCUS; Sent when a list box receives the keyboard focus EndSwitch EndSwitchHi water,in your select statement , you have "Case $LBN_KILLFOCUS; Sent when a list box loses the keyboard focus", in which you catch the lostFocus event on a list box. My question to you is is that event created by you or does it come with AutoIt API?? And also if possible, would you know of a way to do it with an input box, to catch whenever that input box loses the focus??Thanks a lot I would really appreciate your help if you can.the123punch
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