Previous section   Next section

Practical Programming in Tcl & Tk, Third Edition
By Brent B. Welch

Table of Contents
Chapter 48.  Tcl 7.4/Tk 4.0


The focus mechanism has been cleaned up to support different focus windows on different screens. The focus command takes a -displayof argument. Tk remembers which widget inside each toplevel has the focus. When the focus is given to a toplevel by the window manager, Tk automatically assigns focus to the right widget. The -lastfor argument queries which widget in a toplevel will get the focus by this means. Chapter 36 describes focus starting at page 518.

The focus default and focus none commands are no longer supported. There is no real need for focus default anymore, and focus none can be achieved by passing an empty string to the regular focus command.

The tk_focusFollowsMouse procedure changes from the default explicit focus model where a widget must claim the focus to one in which moving the mouse into a widget automatically gives it the focus.

The tk_focusNext and tk_focusPrev procedures implement keyboard traversal of the focus among widgets. Most widgets have bindings for <Tab> and <Shift-Tab> that cycle the focus among widgets.

      Previous section   Next section