Up: Tix Object Oriented Previous: Summary of Widget


Loading the New Classes 

Usually, you can use a separate script file to store the implementaion of each new widget class. If you have several of those files, it will be a good idea to group the files into a single directory and create a tclIndex file for them so that the new classes can be auto-loaded.

Suppose you have put the class files into the directory /usr/my/tix/classes. You can create the tclIndex file using the tools/tixindex program that comes with Tix:

cd /usr/my/tix/classes
/usr/my/Tix8.1/tools/tixindex *.tcl

The tclIndex file must be created by the tixindex program. You cannot use the standard auto_mkindex command that comes with Tcl.

Once you have created the tclIndex file, you can use your new widget classes by auto-loading. Here is a small demo program that uses the new TixArrowButton class:

lappend auto_path /usr/my/tix/classes

# Now I can use my TixArrowButton class!
tixArrowButton .arr -direction n
pack .arr