Jump to content
Sign in to follow this  
Sokko

Detect change of keyboard focus

Recommended Posts

Sokko

I could have sworn I did this once before, but I'm blanking on the exact method, and twenty-odd forum searches turned up nothing. I need a way to tell when the input focus on my GUI changes (from one control to another), and when it does, I need to find out which control currently has the focus. Any suggestions?

Share this post


Link to post
Share on other sites
Sokko

Already tried it. ControlGetFocus gives you back a ClassNameNN (or HWND with ControlGetHandle), but I need an AutoIt control ID as returned by a GUICtrlCreate function.

Share this post


Link to post
Share on other sites
evilertoaster

GUIRegisterMsg(0x0008,"Func1")

will fire whenever it loses focus.

Share this post


Link to post
Share on other sites
Sokko

GUIRegisterMsg(0x0008,"Func1")

will fire whenever it loses focus.

What is "it"? I tried clicking and tabbing all over the place but the function never executed.

Share this post


Link to post
Share on other sites
Sokko

Actually, that did help me out, thanks Smoke! Once I knew what I was looking for, it was easy to rewrite the example to use EN_SETFOCUS instead of EN_CHANGE. It works fine, but it really shouldn't be this hard...

Share this post


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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.