Hi. I've just starting tinkering around with XOTcl the past few days, trying to add it to my repertoire of Tcl OO extensions. It's definitely quite an interesting contrast to others like [incr Tcl] or Snit. While I won't be abandoning either of those, XOTcl is currently my leading candidate for a project I'm likely to be working on through the rest of the year, in large part because of its mixin support.
But one issue I couldn't figure out from my reading of the documentation or examples is whether it's possible to use an object's instance variable as a widget's -textvariable or -listvariable. For example, [incr Tcl] supports the [itcl::scope] command, so I can do something like this:
package require Itcl
::itcl::class Toggle { private variable _state "normal"
constructor {} { checkbutton .cb -text Enable \ -variable [::itcl::scope _state] \ -onvalue "normal" -offvalue "disabled" \ -command [::itcl::code $this toggle] .cb select ;# The checkbutton is initially on
# ... }
private method toggle {} { # ... } }
Is there a similar feature for XOTcl?
Thanks,
- Ken Jones