Updated 2015-06-18 08:52:28 by dkf

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 program (or user) changes a public variable by use of the configure -<VARNAME> newvalue option, then the configbody is called rather like a trace or Itcl trace. So here is the simplest clear example I can conceive (this is not a competition).
  console show;  update idletasks
  package require Itcl
  itcl::class sampleconf { ;# a sample class with a single public variable
    public variable publicv ;# this var is adjusted using the configure -publicv...
    constructor {} { }
    method setpublicv {dn} { set publicv "$dn"   }
   # create a sample instance of the class:
  set btn [sampleconf  h2]
   # add a configbody for publicv
  itcl::configbody sampleconf::publicv  {tk_messageBox -message "Publicv in $this was set to $publicv by a configure command."}
  h2 configure -publicv "A new Value"
   # change the publicv by configure and you see a message box.
  h2 configure -publicv "The same old Value"
  h2 setpublicv "A value which is not sent via the configbody"
   # change the publicv again by configure and again you see a message box.
  h2 configure -publicv "Another Value"

Note that the configbody applies to all instances of sampleconf, but that changing the value of publicv (by calling method setpublicv) does not call the configbody.