Generic FunctionPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.0
Unrevised from 9.0 to 10.0.
9.0 version

set-focus

Arguments: window

This generic function is called whenever a window receives the keyboard focus. Applications may add :after methods in order to be notified when this occurs. The built-in methods should not be overridden. See also clear-focus.

An application may also call set-focus to move the keyboard focus to a particular window. This may not be particularly useful in most applications, because:

  1. When programmatically moving the keyboard focus to a window, it is usually better to call select-window instead to ensure that the window also comes to the front.
  2. set-focus-component can be called instead to move the focus to a particular widget, rather than calling set-focus on the window of the widget.
  3. Common Graphics or the operating system normally moves the keyboard focus to an appropriate child window or control when a parent window is selected.

An application may also pass nil to set-focus to remove the keyboard focus from any window in the current thread, if any such window currently has the focus. This may be useful for momentarily disabling keyboard input, though with-events-disabled (which disables mouse events as well as keyboard input) may be preferable in most cases.

GTK Note

Most window managers will probably not allow you to programmatically move the keyboard focus from another application to yours. Also, it is not possible to remove the focus from all windows, and so (set-focus nil) will have no effect on GTK.


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

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.0
Unrevised from 9.0 to 10.0.
9.0 version