Previous section   Next section

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

Table of Contents
Chapter 51.  Tcl/Tk 8.0

The Patch Releases

There was a hiatus in the development of the 8.0 release as John Ousterhout left Sun Microsystems to form Scriptics Corporation. The 8.0p2 release was made in the Fall of 1997, about the same time the first alpha release of 8.1 was made. Almost a year later there were a series of patch releases: 8.0.3, 8.0.4, and 8.0.5 that were made in conjunction with releases of the TclPro development tools. The main changes in these patch releases were in C APIs that were added to support TclPro Wrapper and TclPro Compiler. These tools are introduced on page 189. There were only a few changes after 8.0p2 that were visible to Tcl script writers, and these are documented here.

fconfigure -error

The fconfigure -error option was added so that you can find out whether or not an asynchronous socket connection attempt has failed. It returns an empty string if the connection completed successfully. Otherwise, it returns the error message.


A new element was added to the tcl_platform variable to indicate that Tcl was compiled with debugging symbols. The motivation for this is the fact that a Windows application compiled with debugging symbols cannot safely load a DLL that has been compiled without debugging symbols. Similarly, an application compiled without debugging symbols cannot safely load a DLL that does have debugging symbols. The problem is an artifact of the Microsoft C runtime library.

When you build Tcl DLLs with debugging symbols their name has a trailing "d", such as tcl80d.dll instead of tcl80.dll. By testing tcl_platform(debug) a savvy application can attempt to load a matching DLL.


The tcl_findLibrary procedure was added to help extensions find their script library directory. This is used by Tk and other extensions. The big picture is that Tcl has a complex search path that it uses to find its own script library. It searches relative to the location of tclsh or wish and assumes a standard installation or a standard build environment. This supports sites that have several Tcl installations and helps extensions find their correct script library. The usage of tcl_findLibrary is:

tcl_findLibrary base version patch script enVar varName

The base is the prefix of the script library directory name. The version is the main version number (e.g., "8.0"). The patch is the full patch level (e.g., "8.0.3"). The script is the initialization script to source from the directory. The enVar names an environment variable that can be used to override the default search path. The varName is the name of a variable to set to name of the directory found by tcl_findLibrary. A side effect of tcl_findLibrary is to source the script from the directory. An example call is:

tcl_findLibrary tk 8.0 8.0.3 tk.tcl TK_LIBRARY tk_library


The auto_mkindex procedure was reimplemented by Michael McLennan to support [incr Tcl] classes and methods. This changed the semantics somewhat so that all procedures are always indexed. Previously, only procedures defined with the word "proc" starting at the beginning of a line were indexed. The new implementation sources code into a safe interpreter and watches for proc commands however they are executed, not how they are typed into the source file. The old version of auto_mkindex was saved as auto_mkindex_old for those applications that used the trick of indenting procedure definitions to hide them from the indexing process.

Windows Keysyms for Start and Menu Keys

The Microsoft keyboards have special keys that bring up the Start menu and trigger menu traversal. New keysyms App, Menu_L, and Menu_R were added for these keys.

The MouseWheel Event

The MouseWheel event was added to support the scrolling wheel built into Microsoft mice. There is a %d event parameter that gets replaced with a positive or negative number to indicate relative scrolling motion.

Transparent Fill on Canvas Text

Canvas text items now honor the convention that an empty fill attribute turns them transparent. This convention was previously implemented for all other canvas item types. This feature makes it easy to hide items with:

$canvas itemconfigure item -fill ""


This procedure was extended to take a -display displayname argument so you can control where the main window of the safe interpreter is created. Its -use argument was extended to take either window IDs or Tk window pathnames.

      Previous section   Next section