jtkversion.tcl
Introduction
The
jtkversion.tcl library is distributed as part of the
jstools package. It consists of procedures to make it easier to
write scripts that will work under both Tk 3 and Tk 4.
This document describes
jtkversion.tcl version 4.1/4.2.
Usage
Accessing the Library
In order to use the
jtkversion.tcl library, it (and any other libraries it depends on) must be
in your Tcl
auto_path, described in
tclvars(n). Information about how to arrange that, and other conventions
common to
the
jstools libraries, is in
the
Usage section of
The jstools Libraries.
Credits and Copyright
Author
Jay Sekora
js@aq.org
http://shore.net/~js/
Copyright
The library is copyright © 1992-1995 by Jay Sekora, but may be
freely redistributed under the conditions at the top of the file.
Overview
Procedures
j:tk4 - perform an action if running under Tk version 4 or greater
j:tk3 - perform an action if running under Tk version 3 or earlier
See Also
jtkutils.tcl
j:tk4
Usage
j:tk4
[command]
Description
This procedure executes
command (in the calling procedure's stack frame) if and only if running
under Tk version 4 or later. It returns
1 if the command was executed (i.e., if the version of Tk it's
running under is 4 or greater) and 0 otherwise. If
command is omitted, no action is performed, but the return value still
indicates what version of Tk is being used.
j:tk3
Usage
j:tk3
[command]
Description
This procedure executes
command (in the calling procedure's stack frame) if and only if running
under Tk version 3 or earlier. It returns
1 if the command was executed (i.e., if the version of Tk it's
running under is 3 or less) and 0 otherwise. If
command is omitted, no action is performed, but the return value still
indicates what version of Tk is being used.
Bugs and Misfeatures
* All these procedures are really misfeatures. :-) They'll
probably go away in the future as Tk 4 becomes more prevalent
and Tk 3 dies out.
* As mentioned,
j:current_focus doesn't handle multiple displays.
Future Directions
* These procedures started as a stopgap solution to get the
jstools applications and libraries, which are written for Tk 3.6, to
run under Tk 4.0. When
jstools no longer supports Tk 3.6, these procedures may go away (or
be replaced with different procedures to support a different historical
range of Tk and Tcl versions).