Next: Methods Up: Introduction to Tix Previous: What is in

 

Variables 

Each widget instance is associated with a set of variables. In the example of an instance of the TixArrowButton class, we may use a variable to store the direction to which the arrow is pointing to. We may also use a variable to count how many times the user has pressed the button.

Each variable can be public or private. Public variables may be accessed by the application programmer (usually via configure or cget methods) and their names usually start with a dash (-). They usually are used to represent some user-configurable options of the widget instance. Private variables, on the other hand, cannot be accessed by the application programmer. They are usually used to store information about the widget instance that are of interests only to the widget writer.

All the variables of an instance are stored in a global array that has the same name as the instance. For example, the variables of the instance .up are stored in the global array .up:. The public variable -direction, which records the direction to which the arrow is pointing to, is stored in .up(-direction). The private variable count, which counts how many times the user has pressed the button, is stored in .up(count). In comparison, the same variables of the .down instance are stored in .down(-direction) and .down(count).


http://tix.sourceforge.net