1tk_focusNext(n) Tk Built-In Commands tk_focusNext(n)
2
3
4
5______________________________________________________________________________
6
8 tk_focusNext, tk_focusPrev, tk_focusFollowsMouse - Utility procedures
9 for managing the input focus.
10
12 tk_focusNext window
13
14 tk_focusPrev window
15
16 tk_focusFollowsMouse
17_________________________________________________________________
18
19
21 tk_focusNext is a utility procedure used for keyboard traversal. It
22 returns the “next” window after window in focus order. The focus order
23 is determined by the stacking order of windows and the structure of the
24 window hierarchy. Among siblings, the focus order is the same as the
25 stacking order, with the lowest window being first. If a window has
26 children, the window is visited first, followed by its children (recur‐
27 sively), followed by its next sibling. Top-level windows other than
28 window are skipped, so that tk_focusNext never returns a window in a
29 different top-level from window.
30
31 After computing the next window, tk_focusNext examines the window's
32 -takefocus option to see whether it should be skipped. If so,
33 tk_focusNext continues on to the next window in the focus order, until
34 it eventually finds a window that will accept the focus or returns back
35 to window.
36
37 tk_focusPrev is similar to tk_focusNext except that it returns the win‐
38 dow just before window in the focus order.
39
40 tk_focusFollowsMouse changes the focus model for the application to an
41 implicit one where the window under the mouse gets the focus. After
42 this procedure is called, whenever the mouse enters a window Tk will
43 automatically give it the input focus. The focus command may be used
44 to move the focus to a window other than the one under the mouse, but
45 as soon as the mouse moves into a new window the focus will jump to
46 that window. Note: at present there is no built-in support for return‐
47 ing the application to an explicit focus model; to do this you will
48 have to write a script that deletes the bindings created by tk_focus‐
49 FollowsMouse.
50
51
53 focus, keyboard traversal, top-level
54
55
56
57Tk 4.0 tk_focusNext(n)