Tk 4.0b1 Release Announement December 23, 1994 John Ousterhout Sun Microsystems, Inc. john.ousterhout@eng.sun.com I have just released Tk version 4.0b1, the first beta release of Tk version 4.0. It is available now via FTP from ftp.cs.berkeley.edu (/ucb/tcl/tk4.0b1.tar.Z) and it should reach the standard Tcl/Tk mirror sites soon. This is a truly major release. There are many new features, many bug fixes, and many other changes. There are about 30 incompatible changes that affect Tcl scripts and a few more that affect C code. Even so, not all of the things that were "on the list" made it into the final release. The most important things that didn't make it were application embedding and most of the changes planned for canvases. Apologies to those of you that were waiting specially for these features. Application embedding will appear soon in a follow-on release, but I'm not sure when the canvas changes will happen. The rest of this message is a summary of what has changed in this release. For more complete information, refer to the "changes" file that comes with the release. Here is a list of the most important new features: 1. All of the widgets have been overhauled. The most important change is better Motif compliance, including a completely new set of bindings to match Motif. Text and entry widgets also have a set of Emacs-like bindings. Some additional changes to widgets: - All widgets now have a "cget" widget command, which provides a simpler way to retrieve the value of a configuration option. - All widgets have -highlightthickness and -highlightcolor options for controlling the traversal highlight, and the traversal highlight is displayed whenever the widget has the input focus. - Entries support justification and a "-show" option for (not) displaying passwords. They will autosize to fit their text if "-width 0" is specified. - The label/button family of widgets now supports multi-line text and justification. The -selector option for check and radio buttons has been replaced with -selectcolor and -indicatoron options. - Listboxes support all of the Motif selection modes (e.g. single and multiple selections, and disjoint selections); the "selection" widget command changed to support this. Listboxes will auto-size around their contents if "-width 0" or "-height 0" is specified, and they have new "see", "bbox", and "activate" widget commands. - Scales support real values and a linked variable, and their bindings are now defined in Tcl instead of being hard-wired in C. Several of the configuration options have been renamed. - Scrollbars have a new interface to the controlling widget, which provides more flexibility than the old style (the old style is still supported, for compatibility). The behavior of scrollbars is now defined with Tcl bindings rather than being hard-wired in C, and there are several new widget commands for scrollbars. Several of the configuration options have been renamed. - Menu entries support several new options such as -foreground and -indicatoron, and tear-off menus have been reimplemented to be more Motif-like. The procedures "tk_menuBar" and "tk_bindForTraversal" are no longer needed, but they exist as empty stubs for compatibility. - Menu buttons have a -indicatoron option for displaying an option menu indicator. Also, there is built-in support for option menus and popup menus: see the manual entries for tk_optionMenu and tk_popup. 2. Changes to the binding mechanism: - One binding triggers now for each binding tag (widget, class, "all", etc.) instead of just one overall. - A new command, "bindtags", provides control over the number and order of the binding tags for a widget. The default is class, widget, its toplevel, and "all". - "Break" and "continue" have meaning within binding scripts. - Extraneous modifiers are now ignored in bindings, as if every binding had an implicit "Any" modifier. - The Meta and Alt modifiers are now computed from the modifier map instead of being hard-wired to M1 and M2. 3. Tk now contains a general-purpose image mechanism, including the following: - There is a new command "image" for creating images. - Many widgets provide a "-image" option. - Canvases contain a new "image" canvas item type. - There is built-in support for two kinds of images: bitmaps and photos. The photo image type was provided by Paul Mackerras and is based on his "photo" widget. It currently supports only PPM-format images, but can easily be extended to handle other image types (see the manual entry for Tk_CreatePhotoImageFormat). - There is an extension mechanism for defining new kinds of images. See the manual entry for Tk_CreateImageType. 4. Text widgets have undergone a major overhaul, including the following: - They now support embedded windows; read about the "window" widget command. - Many new tag configuration options have been added to support justification, margins, line spacing, and vertical offsets. - Added horizontal scrollling. - Tags have been reimplemented so that they aren't sticky on either side: a new character gets a tag only if the old characters on both sides of it were tagged. There is also an optional "tagList" argument to the "insert" widget command for specifying tags for new text. - Marks have "gravity" to control which way the mark moves when text is inserted at its position; see the "mark gravity" widget command. - There are several new widget commands: "search", "bbox, "dlineinfo", and "see". - The "end" tag now refers to a position just after the final newline, rather than just before it. You can now tag the newline and set marks after it. 5. Event handling has been improved in several ways: - Mark Diekhan's "addinput" command has been incorporated under the name "fileevent". - "After" bindings can be cancelled now. - The event code has been repackaged so that it can be used without the rest of Tk (see the manual entry for Tk_EventInit). - There is a new form of file event handler: see the manual entry for Tk_CreateFileHandler2. 6. Changes in the focus mechanism: - Keyboard traversal of widgets is now built in. See the manual entry for "tk_focusNext". - Multiple displays are supported via the -displayof option to "focus". - There is always a focus window now ("focus none" is no longer allowable. There is no "default" focus window; instead, the focus reverts to top-levels by default. - Tk keeps track of a separate focus window for each top-level window and automatically moves the focus there whenever the window manager gives the focus to a top-level. The default is to use click-to-focus within a top-level but focus-follows-mouse between top-levels; however, you can make the focus follow the mouse within a top-level too; see the manual entry for "tk_focusFollowsMouse". - Tk no longer synthesizes FocusIn and FocusOut events now; it just uses the standard X events. 7. Changes in the "send" command: - "Winfo inters" no longer returns stale intepreter names. - Mutliple displays are supported via the "-displayof" option. - Asynchronous sends are permitted with the "-async" switch. - Timeouts no longer occur, so sends can take as long as you like; a send won't abort as long as the target application still exists. - You can change the application's name with "tk appname". - Window server security is checked on each send now. - More complete error information is propagated back to the caller now ("errorInfo" and "errorCode" variables). 8. Selection support has been improved to handle multiple displays and different kinds of selection (primary, secondary, etc.). There is special support for the clipboard in the form of a new "clipboard" command and procedure Tk_ClipboardClear and Tk_ClipboardAppend. 9. Changes to canvases: - The interface between generic canvas code and the various canvas item types has been cleaned up, documented, and officially exported so that you can define new item types. See the manual entry for Tk_CreateItemType. - Bitmap items are now transparent if the -background option is specified as empty. - Several bugs relating to Postscript generation and arrowheads have been fixed. 10. Changes to the Wish application: - The "-file" keyword is no longer required (but it is still supported for compatibility): if the first argumen to wish doesn't start with "-", it is assumed to be the name of a script file, just as for sh. - It now uses a class name based on the application name, rather than always using "Tk" as the class. - Also, the main program for Tk has been renamed "Tk_Main", and the real "main" is now part of tkAppInit.c. - The -help option is no longer supported. 11. There is now explicit support in Tk for colormaps and visuals, including -colormap and -visual options for toplevels and frames, new commands "winfo visualsavailable" and "wm colormapwindows", and procedures Tk_GetVisual, Tk_GetColormap, and Tk_FreeColormap. 12. Toplevel windows are now resizable by default, and "wm iconwindow" should work now (it never really worked before). 13. I've patched around the Xlib bug whereby long-lived applications used to crash because resource ids wrapped around. 14. Geometry management has been improved in several ways: - The -in option should now work correctly in the placer and packer (it was quirky before). - You can find out which manager controls a slave with the "winfo manager" comamnd. - The C interfaces to geometry management have been reworked: see the manual entry for Tk_ManageGeometry. 15. There is a new "bell" command that does what you would expect. Here is a list of incompatibilities that may affect Tcl scripts: 1. Conflict resolution in bindings is different: if you have bindings that augment or override class bindings, you'll probably have to rework them. 2. The -geometry option has been removed from toplevels, frames, and listboxes; use -width and -height instead. 3. When new text is added to a text widget, it only receives tags present on *both* sides of the insertion point (it used to receive any tags present to the left of the character). 4. The class of Tk applications is no longer "Tk"; it is the name of the script or program that embodies the application. 5. The default padding for buttons and menubuttons has been changed to match normal Motif behavior. 6. Listboxes now return the selection as a string with one line per entry, instead of a list. 7. The transport format used for "send" has changed, so Tk 4.0 applications cannot communicate with Tk 3.6 applications. 8. In entries, sel.last refers to the character just *after* the last selected one, and the second index to the "delete" widget command also refers to the character just after the last one to delete. 9. The "Any" modifier is now implicit in all bindings. 10. In scrollbars, the -background option has been renamed to -troughcolor, -foreground has been renamed to -background, and -activeforeground has been renamed to -foreground. 11. In scales, the -sliderforeground option has been renamed to -background, -background has been renamed to -troughcolor, and -activeforeground has been renamed to -activebackground. 12. For checkbuttons, radiobuttons, and the corresdponding menu entries, the -selector option has been renamed to -selectcolor, and it can no longer be specified as empty; instead, use the -indicatoron option to specify whether or not to draw the indicator. 13. In binding scripts, % sequences that print window identifiers, such as %a and %S, produce hexadecimal results instead of decimal. 14. The "enable" and "disable" widget commands have been eliminated for menus: use the -state configuration option instead. 15. The "activate" and "deactivate" widget commands have been eliminated for buttons, checkbuttons, radiobuttons, and menubuttons; use the -state configuration option instead. 16. The obsolete variable "tkVersion" is no longer supported; use tk_version instead. 17. The syntax of the "scan" widget command for texts has changed. 18. Wish no longer recognizes the -help option. 19. Tk always prints real numbers, such as canvas coordinates, with a decimal point, so that they cannot get confused with integers. 20. The command "pack newinfo" has been renamed to "pack info", and the old "pack info" command (which was obsolete) no longer exists. 21. The -scrollcommand option for entries has been changed to -xscrollcommand, and the "view" widget command has been changed to "xview". 22. "Winfo exists" no longer reports a window as existing if it is in the process of being destroyed. 23. The -padx and -pady options for the button family of widgets are ignored if the button is displaying an image or bitmap; padding is zero in these cases. 24. In radiobuttons the -value option no longer defaults to the name of the widget: an empty string is a valid value for it. 25. The -menu option for menubuttons and cascade menu entries must refer to a child of the menubutton or menu. 26. The interpretation of "@y" in menus has changed: it no longer returns "none". 27. The selection targets APPLICATION and WINDOW_NAME have been replaced with TK_APPLICATION and TK_WINDOW. 28. There is no longer a default focus, and "focus none" is no longer supported. The focus command now returns an empty string instead of "none" to signal that the application doesn't have the input focus. 29. FocusIn and FocusOut events now use the standard X mechanism, so the number and types of these events is different now. 30. "wm maxsize" and "wm minsize" no longer accept empty arguments. 31. The -scrollincrement option for canvases has been eliminated. Here are the incompatibilities that affect C code that uses the Tk library: 1. The arguments to Tk_ManageGeometry have changed. 2. The "main" procedure is no longer provided by Tk; it should now be in the same file as Tcl_AppInit (see tkAppInit.c for an example). 3. "fill" justify mode is no longer supported by Tk_GetJustify, and the TK_CONFIG_JUSTIFY flat no longer exists (no widgets actually supported this mode anyway). 4. The procedures Tk_GetSelection, Tk_CreateSeleHandler, and Tk_ClearSelection now take an additional "selection" argument. 5. The obsolete procedure Tk_CreateFocusHandler has been removed. 6. The procedure Tk_RegisterInterp no longer exists; Tk_SetAppName now provides similar functionality. 7. The "interp" argument to Tk_GetcolorByValue has been eliminated.