|The PLplot Plotting Library: Programmer's Reference Manual|
|Prev||Chapter 16. Building an Extended WISH||Next|
Another extremely powerful and popular extension to Tcl is [incr Tcl]. [incr Tcl] is to Tcl what C++ is to C. The analogy is very extensive. Itcl provides an object oriented extension to Tcl supporting clustering of procedures and data into what is called an itcl_class. An itcl_class can have methods as well as instance data. And they support inheritance. Essentially if you know how C++ relates to C, and if you know Tcl, then you understand the programming model provided by Itcl.
In particular, you can use Itcl to implement new widgets which are composed of more basic Tk widgets. A file selector is an example. Using Tk, one can build up a very nice file selector comprised of more basic Tk widgets such as entries, listboxes, scrollbars, etc.
But what if you need two file selectors? You have to do it all again. Or what if you need two different kinds of file selectors, you get to do it again and add some incremental code.
This is exactly the sort of thing object orientation is intended to assist. Using Itcl you can create an itcl_class FileSelector and then you can instantiate them freely as easily as:
FileSelector .fs1 .fs1 -dir . -find "*.cc"
and so forth.
These high level widgets composed of smaller Tk widgets, are known as "megawidgets". There is a developing subculture of the Tcl/Tk community for designing and implementing megawidgets, and [incr Tcl] is the most popular enabling technology.
In particular, it is the enabling technology which is employed for the construction of the PLplot Tcl extensions, described below.