Jump to content

Recommended Posts

Posted

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:

  Reveal hidden contents

 

Posted

water

Example:

#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
Posted

Hi rasim,

works great - thanks a lot!

Thomas

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

Hi rasim,

works great - thanks a lot!

Thomas

My UDFs and Tutorials:

  Reveal hidden contents

 

  • 4 weeks later...
Posted

  water said:

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

Hi 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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...