When you're dealing with a mega-widget class, you should create mega-widget options instead of public variables. In theory,
the public variables should work (in case they come from a mix-in class), but they don't quite work right. This isn't much of a
problem, because most people use the "itk_option define" instead of public variables in their mega-widgets, as shown below:
package require Iwidgets
class BottomClass {
inherit itk::Widget
itk_option define -charlie charlie Charlie "" {
puts "new value for -charlie: $itk_option(-charlie)"
}
constructor {args} {
eval itk_initialize $args
puts "Charlie is -->$itk_option(-charlie)<--"
puts "Charlie is -->[$this cget -charlie]<--"
}
}
class TopClass {
inherit BottomClass
constructor {args} {
eval itk_initialize $args
}
}
BottomClass .bc
TopClass .tc
TopClass .tc2 -charlie "Second"
Note that each "itk_option define" has three names for an option: the switch name (-charlie), the resource name (charlie), and
the resource class (Charlie). The resource name/class are useful for "option add" statements. The plain public variable
declaration doesn't have room for source name/class info. That's why you're supposed to use "itk_option define" for
mega-widgets. (from a Michael McLennan posting)