Next: Chaining the subwidget Up: Accessing The Components Previous: Subwidget Names

 

The subwidget Method 

All Tix mega-widgets support the subwidget method. This method takes at least one argument, the name of a subwidget. When you pass only one argument to this method, it returns the pathname of the subwidget which is identified by that name. For example, if .c is the pathname of a TixControl widget, the command:

.c subwidget entry

returns the pathname of the entry subwidget, which is .c.frame.entry in this case.

If you call the subwidget method with additional arguments, the widget command of the specified subwidget will be called with these arguments. For example, if .c is, again, the pathname of a TixControl widget, the command:

.c subwidget entry configure -bg gray

will cause the widget command of the entry subwidget of .c to be called with the arguments configure -bg gray. So actually this command will be translated into the following call:

.c.frame.entry configure -bg gray

which calls the configure method of the entry subwidget with the arguments -bg gray and changes its background color to gray.

We can call the subwidget method with other types of arguments to access different methods of the specified subwidget. For example, the following call:

.c subwidget entry icursor end

calls the icursor method of the entry subwidget with the argument end and sets the insert cursor of the entry subwidget to the end of its input string.


http://tix.sourceforge.net