Name
focus
- focus
[[
option
]window
]tk_focusFollowsMousetk_focusNext windowtk_focusPrev window Manage the Tk input focus. At any given time, one window on each display is given the focus so that key press and key release events for the display are sent to that window. Tk remembers the last window in each top-level window to receive the focus. When the window manager gives the focus to a top-level window, Tk automatically redirects it to the remembered window.
Focus within a Tk top-level window uses an explicit focus model by default (i.e., moving the mouse within a top-level window does not change the focus). The model can be changed to implicit (focus changes to a window whenever the mouse enters it) by calling the tk_focusFollowsMouse procedure.
The Tcl procedures tk_focusNext and tk_focusPrev implement a focus order among the windows of a top-level window. They return the next and previous windows after
window
in the focus order that accepts the focus (see the -takefocus widget configuration option). The focus order is determined by the structure of the window hierarchy and by the stacking order of the windows among siblings.The focus command can take the following forms:
- focus
[-displayof
window
] Return the pathname of the focus window on the display containing
window
. If not given,window
defaults to the root window.- focus
window
If the application currently has the input focus for
window
’s display, the focus is given towindow
. Otherwise,window
is made the remembered focus window for ...
- focus
[-displayof
Get Tcl/Tk in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.