Flylib.com

Books Software

 
 
 

CDE Border Width

   

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

Table of Contents
Chapter 51.  Tcl/Tk 8.0


CDE Border Width

On UNIX, the default border width changed from 2 to 1 to match the CDE look and feel.


   
Top
 

   

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

Table of Contents
Chapter 51.  Tcl/Tk 8.0


Native Buttons and Scrollbars

Buttons, menus , and scrollbars are native widgets on Windows and Macintosh. This goes a long way to providing your applications with a native look. The bindings on the text and entry widgets were also tuned to match platform standard bindings. See page 332 for an example of the same Tk program on all platforms.

Buttons on all platforms support a -default attribute, which has three values: active , normal , and disabled . The active state displays as a default button. The normal state displays like a regular button, but leaves room for the highlight used in the active state. The disabled state, which is the default, may be smaller. You still need to program a key binding that invokes the button.


   
Top
 

   

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

Table of Contents
Chapter 51.  Tcl/Tk 8.0


Images in Text Widgets

The text widget supports embedded images. They work much like the embedded windows but provide a more efficient way to embed images. These are described on page 466.


   
Top
 

   

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

Table of Contents
Chapter 51.  Tcl/Tk 8.0


No Errors from destroy

The destroy command used to raise an error if the window did not exist. Now it does not.


   
Top
 

   

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

Table of Contents
Chapter 51.  Tcl/Tk 8.0


grid rowconfigure

The grid columnconfigure and rowconfigure commands take an argument that specifies a row or column. This value can be a list:

grid columnconfigure {0 3}-weight 1

   
Top
 

   

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.

tcl_platform(debug)

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.

tcl_findLibrary

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

auto_mkindex_old

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 ""

safe::loadTk

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.


   
Top