 
 subsubsection3_8_5_3.html  subsection3_8_5.html  subsubsection3_8_5_1.html  tableofcontents3_1.html   Next: subsubsection3_8_5_3.html Public Variable Configuration Up: subsection3_8_5.html Declaring and Using  Previous: subsubsection3_8_5_1.html Initialization of Public     Type Checker  
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. The following code
  specifies the type checker procedure 
CheckDirection for the
  
-direction variable:
      -configspec {        {-direction direction Direction e CheckDirection}
        {-state state State normal}
    }
    ...
}
proc CheckDirection {dir} {
    if {[lsearch {n s w e} $dir] != -1} {
        return $dir
    } else {
        error "wrong direction value $
$"$dir$$""}
   Notice that no type checker has been specified for the 
-state  variable and thus its value will not be checked.
   If a type checker procedure is specified for a public variable, this
  procedure will be called once the value of a public variable is
  determined by the three steps mentioned above.
http://tix.sourceforge.nethttp://tix.sourceforge.net 