A few new features crept into Tk 4.0 as this book went to press. Some of the tables omit the following features.
All widgets have a
highlightBackground attribute that specifies the color of the highlight rectangle when the widget does not have input focus.
All widgets have a
takeFocus attribute that determines if they will take the focus when keyboard traversal is used to change focus among widgets. There are four possible values. 0 indicates the widget should not take focus. 1 indicates the widget should always take focus. An empty string means the traversal procedures (e.g.,
tk_focusPrev) should decide based on the widget's state and bindings. Otherwise the value is a Tcl command prefix. The command is called with the widget name as an argument, and it should return either 0, 1, or the empty string.
Menus have an
insert operation that adds an entry before a specified index. They also have a
postcascade operation that posts the menu of a cascade entry. See page 411 for examples.
Text widgets have adjustable tab stops. The
tabs attribute is a list of tab stops, which are specified with a screen unit and optionally a keyword that indicates justification. The attribute applies to the whole text widget or to a tag. The tab justification keywords are
numeric, and these can be abbreviated. The default is
left. The last tab stop is extrapolated as needed. A left, right, and numeric tab could be specified with this resource specification:
*Text.tabs: 1c 4c r 8c n
-overstrike tag attribute draws a horizontal line through characters.
Table 19-7 omits these standard attributes:
height, which is in text lines,
Table 33-2 describes several new winfo operations that are not described in Chapter 26. In addition, note that the winfo atom, winfo atomname, and winfo pathname operations all take an optional -displayof win argument like the winfo interps command.
Table 33-2 New
winfo colormapfull win Returns 1 if the last color allocation failed. winfo pointerx win Returns the X screen coordinate of the mouse. winfo pointery win Returns the Y screen coordinate of the mouse. winfo screenvisual win Returns the default visual of the screen. winfo viewable win Returns 1 if win and all its parent windows are mapped. This is more reliable than ismapped.
In Tk 3.6 color allocations could fail if the colormap was full. In this case Tk would revert its colormodel to monochrome and only use black and white. The
tk colormodel command was used to query or set the colormodel. In Tk 4.0 color allocations do not fail. Instead, the closest possible color is allocated. Because of this, the
tk colormodel operation is no longer supported. See Example 26-3 on page 319 for a procedure that emulates this function.
I have established a home page for this book on the World Wide Web. Check this site for corrections and other news about this book.