sandyd Posted August 23, 2013 Posted August 23, 2013 Hi everyone, Simple question but cant find an answer anywhere: On a user created GUI, how can I determine the handle of the input control that's currently has focus? TIA, Sandy ----[ SandyD ]---
Solution FireFox Posted August 23, 2013 Solution Posted August 23, 2013 Hi, Here you go:expandcollapse popup#include <WindowsConstants.au3> #include <GUIConstants.au3> #include <EditConstants.au3> #include <Constants.au3> Global $_iInputFocused = -1 GUICreate("MyGUI") Local $iInput1 = 0 For $i = 1 To 3 $iInput1 = GUICtrlCreateInput("", 10, 10 + 25 * $i) GUICtrlSetData($iInput1, "My id: " & $iInput1) Next Local $iBtn1 = GUICtrlCreateButton("Which has focus?", 10, 150) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUISetState(@SW_SHOW) While 1 Sleep(10) Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $iBtn1 MsgBox($MB_SYSTEMMODAL, "", "input id focused: " & $_iInputFocused) EndSwitch WEnd GUIDelete() Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) Local $iCode = BitShift($iwParam, 16) Local $iIDFrom = BitAND($iwParam, 0x0000FFFF) Switch $iCode Case $EN_SETFOCUS $_iInputFocused = $iIDFrom EndSwitch Return $GUI_RUNDEFMSG EndFunc Br, FireFox.
sandyd Posted August 23, 2013 Author Posted August 23, 2013 Superb, Just what I needed. ----[ SandyD ]---
FireFox Posted August 23, 2013 Posted August 23, 2013 The best answer is to redirect people to what solved the topic, if you mark your post as the answer actually it's not.
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