Next: Public Variable Configuration Up: Declaring and Using Previous: Declaring and Using

 

Initialization of Public Variables

When a widget instance is created, all of its public variables are initialized by the Tix Intrinsics before the InitWidgetRec method is called. Therefore, InitWidgetRec and any other method of this widget instance are free to assume that all the public variables have been properly initialized and use them as such.

The public variables are initialized by the following criteria:

Step 1
If the value of the variable is specified by the creation command, this value is used. For example, if the application programmer has created an instance in the following way:

tixArrowButton .arr -direction n

The value n will be used for the -direction variable.

Step 2
if step 1 fails but the value of the variable is specified in the options database, that value is used. For example, if the user has created an instance in the following way:

option add *TixArrowButton.direction w
tixArrowButton .arr

The value w will be used for the -direction variable.

Step3
if step 2 also fails, the default value specified in the -configspec section of the class declaration will be used.

You can use a type ckecker procedure to check whether the user has supplied a value of the correct type for a public variable. The type checker is specified in the -configspec section of the class declaration after the default value.


http://tix.sourceforge.net