Jump to content

isPressed on focused control


Recommended Posts

Guten Morgen zusammen,

ich möchte die Funktion isPressed nutzen, allerdings nur wenn die Eingabe in einer bestimmten Textbox ist. Wie kann ich herausfinden, ob die Textbox gerade focused ist?

Viele Grüße

Ziller

 

Good Morning all,

I want to use the isPressed function, but only when the input is in a specific textbox. How can I predict if the textbox is currently focused?

Many greetings

Ziller

Link to post
Share on other sites

Not sure if it is your own GUI, but here one way :

#include <Misc.au3>
#include <GUIConstants.au3>
#include <Constants.au3>
#include <WinAPIConv.au3>

Local $hGUI = GUICreate("Example", 200, 200)
Local $box = GUICtrlCreateInput("", 1, 30, 170, 30)

GUIRegisterMsg($WM_COMMAND, WM_COMMAND)

GUISetState()

While True
  Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
      ExitLoop
  EndSwitch
WEnd

Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
  Local $iIDFrom = _WinAPI_LoWord($wParam)
  Local $iCode = _WinAPI_HiWord($wParam)
  If $iCode = $EN_CHANGE And $iIDFrom = $box Then
    If _IsPressed("41") Then ConsoleWrite("a" & @CRLF)
  EndIf
  Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_COMMAND

 

Link to post
Share on other sites

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...