Meaning of "Keyboard Focus"

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
WeThotUWasAToad
Posts: 312
Joined: 19 Nov 2013, 08:44

Meaning of "Keyboard Focus"

21 May 2016, 21:20

Hello,

What does "keyboard focus" mean as used in the following paragraph?
GuiControlGet, OutputVar, Focus: Retrieves the control identifier (ClassNN) for the control that currently has keyboard focus. Since the specified GUI window must be active for one of its controls to have focus, OutputVar will be made blank if it is not active. Example usage: GuiControlGet, focused_control, focus.
The quoted paragraph comes from the AHK documentation located here:
https://autohotkey.com/docs/commands/GuiControlGet.htm

Thanks
A ------------------------------ [A LOT OF SPACE] ------------------------------ LOT

"ALOT" is not a word. It never has been a word and it never will be a word.
"A LOT" is 2 words. Remember it as though there's [A LOT OF SPACE] between them.
just me
Posts: 9458
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Meaning of "Keyboard Focus"

22 May 2016, 02:11

All keyboard input will be send to the control which currently has the keyboard focus (in other words: the active input capable control in the active window).
User avatar
trismarck
Posts: 506
Joined: 30 Sep 2013, 01:48
Location: Poland

Re: Meaning of "Keyboard Focus"

22 May 2016, 16:22

So to rephrase it a little: when the system detects keyboard input (i.e. the user has pressed the key on the keyboard), the system posts a message (actually, places the message in the input queue associated with a given thread I guess) to the message queue of the thread whose window currently has keyboard focus. That window is I guess usually a control.
A similar scenario occurs for mouse input - when the system detects mouse input, the system posts a message to the message queue of the thread whose window was under the cursor. It works a little bit differently for dialogs I guess and mouse messages aren't really posted to the message queue, but those are some internal details about how winapi really works under the hood.
And for other types of input, Windows I guess takes a similar approach - when the system detects X input, the system posts a message to the message queue of the thread whose window Y.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: sachinme and 353 guests