Previous section   Next section

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

Table of Contents
Chapter 28.  The Resource Database

Adding Individual Database Entries

You can enter individual database entries with the option add Tcl command. This is appropriate to handle special cases, or if you do not want to manage a separate per application resource specification file. The command syntax is:

option add pattern value ?priority?

The priority is the same as that used with option readfile. The pattern and value are the same as in the file entries, except that the key does not have a trailing colon when specified in an option add command. If value contains spaces or special characters, you will need to group it like any other argument to a Tcl command. Some of the specifications from the last example could be added as follows:

option add *foreground black
option add *selectBackground #bfdfff

You can clear the option database:

option clear

However, on UNIX the database will be initialized from your ~/.Xdefaults file, or the RESOURCE_MANAGER property on the root window, the next time the database is accessed.

      Previous section   Next section