Tk's [option] command manages the "option database" or "resource database". ---- [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:)'' [http://www.regularexpressions.com/#options0], ''(broken:)'' [http://www.regularexpressions.com/#options], and ''(broken:)'' [http://www.regularexpressions.com/#options2]. Also, in case '''that''' archive is lost, draft forms of the pieces are available here [http://phaseit.net/claird/comp.lang.tcl/option_database/1], here [http://phaseit.net/claird/comp.lang.tcl/option_database/2], and here [http://phaseit.net/claird/comp.lang.tcl/option_database/3]. * 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 [LV] The part 3 article makes reference to a part 4 - did that article get written, and if so, is it available online? 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 ...]] ---- [[... 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:dmlb@ragnet.demon.co.uk (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:dhagberg@millibits.com (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 [http://www.cs.man.ac.uk/~fellowsd/tcl/option-tutorial.html%|%little tutorial] I wrote. This is also on the CD that goes with [Clif Flynt]'s book. DKF's "how to use option get" [http://www.gidhome.com/ManHtml/HowTo/resource/tk_option.tutorial] 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-29 I removed double content and changed websites form "www.phaseit.net" to ""phaseit.net" Found the original articles in http://www.itworld.com <> Tk syntax help | Tutorial