Generic Function | Package: cg | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Unrevised from 8.2 to 9.0. 8.2 version

## get-focus

Arguments: &optional ignored

Returns the window that currently has the global keyboard focus, if any, or else `nil`. The window that has the keyboard focus at any moment is the one that will receive all keyboard events. The focus is usually indicated visually in some way, such as by a dashed bounding rectangle or inverted text. The focus may be moved to another window by calling set-focus. It is possible for no window to have the focus.

The keyboard focus is normally in a window that has no child windows, since parent windows tend to move the focus to one of their child windows. When a dialog is selected, for example, the dialog's toolbar will be highlighted to indicate that it is the selected-window, but the keyboard focus will be in the window of one of the widgets on the dialog.

get-focus is thread-specific. If the focus is currently in a window that was created by the thread that is calling get-focus, or if there is a window hierarchy that contains windows from both the calling thread and window's creation thread, then that window is returned. Otherwise `nil` is returned. (set-focus, on the other hand, will move the focus to a window in any thread of that lisp environment.) Note that mixing windows from multiple threads in a single window hierarchy is not recommended, since this is prone to messaging deadlocks.

Compatibility note: The optional argument is called ignored because it is ignored. In releases through version 6.0 it was documented as optionally specifying a parent stream but in fact it was always ignored since the keyboard focus is global. The argument is accepted for backward compatibility and since the argument was always in fact ignored, no behavior is changed if you specify any value or do not specify a value.

See also selected-window.

Copyright (c) 1998-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 8.2 page.
Created 2012.5.30.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Unrevised from 8.2 to 9.0. 8.2 version