Allen Flick and Cameron Laird wrote a series of articles in 2000-2001 for SunWorld Online magazine on use of the options database. While the magazine foundered, the first three installments appear to be safe at (broken:) [1], (broken:) [2], and (broken:) [3]. Also, in case that archive is lost, draft forms of the pieces are available here [4], here [5], and here [6].
- Part 1: http://www.itworld.com/article/2795871/development/individualize-your-apps.html
- Part 2: http://www.itworld.com/article/2795872/development/making-the-most-of-the-tk-option-database.html
- Part 3: http://www.itworld.com/article/2795849/development/options-for-the-tk-option-database.html
[... a fundamental difference between the way Tcl handles options and the way Xt handles options; Tcl has separate priorities and within a level prefers the latest matching option, Xt prefers options with "more exact" specifiers and has no level semantics.]
What: | Tk X11 support code |
Where: | http://www.ragnet.demon.co.uk/ |
Description: | Contact has several extensions. One provides Xt like resource management from Tk. Another decodes X11 events from bindings. Yet another deals with double clicking by inserting special bindings into bindtags. |
Updated: | 03/1999 |
Contact: | mailto:[email protected] (Duncan Barclay) |
Semi-related:
What: | CDE |
Where: | ftp://ftp.procplace.com/pub/tcl/sorted/x11/cde/0.3.0/ |
Description: | Get Tk to look good under CDE, using the Tk options database as well as the user's CDE configuration files. |
Updated: | 07/1999 |
Contact: | mailto:[email protected] (D. J. Hagberg) |
Notice DKF's acute comments in "A User's Guide to Tcl/Tk". DKF says A good place to start looking is in a little tutorial I wrote. This is also on the CD that goes with Clif Flynt's book.DKF's "how to use option get" [7] covers much of the same territory in detail-oriented recipes.
Kevin Kenny explains how easy it is to determine a widget's associated resources in a posting to comp.lang.tcl, where he offers:
proc listResources { w } { set retval {} set head [tk appname]$w foreach tuple [$w configure] { if { [llength $tuple] == 5 } { lappend retval $head.[lindex $tuple 1] } } return $retval }He goes on to offer the example, "If you launch tkcon, for instance, create a label, and run this procedure, you'll discover that the resources are:
tkcon.foo.activeBackground tkcon.foo.activeForeground ..."In the same thread, LV muses, "perhaps a resource browser added to tkinspect would be a really nice enhancement. I'd love to see a resource editor too - where I could just click on a widget and see its current values and then interactively change the ones I wanted; alas, most apps won't be set up to remember such changes, and some might not be set up to even allow such introspective interaction."
Another potentially useful tool when developing applications that make use of the option database dynamically is tkstyle.In the meantime, Gerald Lester posted a follow-up which coincidentally succinctly summarizes several highlights of the series: "Instead of a global variable, the color and font specified in Tk's option database should be set.I'd also use the font command to create the font (e.g. myButtonFont). That way the font could be changed at run time and all the buttons affected.I'd also use tk_setPalette to change the colors at run time." [... solving problems with another level of indirection ...]
AMucha 2015-05-29I removed double content and changed websites form "www.phaseit.net" to ""phaseit.net" Found the original articles in http://www.itworld.com