[ Someone want to write up something about what this incr tcl command does?
AW from the source code of itcl3.3:
* itcl::configbody <class>::<publicVar> <body> * * Looks for an existing public variable with the name <publicVar>, * and if found, tries to assign the implementation. If <body> has * the form "@name" then it is treated as a reference to a C handling * procedure; otherwise, it is taken as a body of Tcl statements. *
As far as I understand it: if you assign a public variable a value with the itcl configure command (myclass configure -myvar Hello) then first the new value is assigned to that variable and afterwards the script in configbody is evaluated additionally.
It is also possible to define a config script for a variable when defining the variable: protected variable myvar hello {puts "this is the configscript of myvar"}
GWM at last it becomes vaguely less fog encrusted, when the ptrogram (or user) changes a public variable by use fo the 'configure -<VARNAME> newvalue' option then the configbody is called. So here is a simplified example.
console show; update idletasks package require Itcl itcl::class hellobtn { ;# a button restricted to the values 0-9 public variable publicv ;# this var is adjusted using the configure -publicv... constructor {frm} { } method increm {dn} { set publicv "$dn" } } # create a sample case: set btn [hellobtn h2 .] itcl::configbody hellobtn::publicv {tk_messageBox -message "HOOP $publicv"}
h2 configure -publicv bump
Category Command a part of the incr tcl object oriented package