Generic Function | Package: cg | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 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-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version