Googie - There is a simpe way to write Itcl widgets, which work similar to Tk ones (becouse, as we know, Itcl objects work similar to Tk objects), but - it's important - without using itk (useful for starpacks).
To implement some widget, we need to write Itcl class like below:
class Widget { constructor {args} { set w .[lindex [split $this "::"] end] ;# here we hack object name to be [Tk] widet tree compatybile # here parsing options while constructing widget, such as colors, layout, etc } destructor { destroy $w # btw. - we need to bind $w destroying event to delete $this object } protected { variable w ;# this is our widget path } # and here, whatever you need... }
This allows to do the following:
Widget wid -some_option value pack .wid wid some_method delete wid
or
Widget some_frame.widget pack .some_frame.widget
etc.
...and Itcl syntax allows to implement such widgets in very, very easy way! :)
Have you some additional hints?
Sarnold 2005-07-16 -- Thanks for this work : I will probably use it for itins to build a itins::widget command
I almost always use tclkit as my Tcl interpreter, so I have to choose between incr Tcl and snit, that is just the way I came to building itins, trying as well as I can to get the best of both.