Check out the new USENIX Web site. next up previous
Next: Conclusion Up: Canvas Improvements Previous: Selection Based on Multiple

Megaitems

The Tcl community has expressed a desire to have megawidget support added to Tk. Megawidgets [3,11,12] are new widgets created entirely with Tcl code from more basic widgets. No C programming is required to construct megawidgets, and they are indistinguishable from native widgets. A SuperWidget megawidget can be created with Tcl code such as SuperWidget .myWidget and configured with code like .myWidget configure -relief sunken. Because megawidgets have the same interface as a native widget, they can be replaced by native widgets, if they become available, without changes to the code that uses them. Although megawidget support is not yet an official part of Tk, the Tcl community has addressed this need.

We believe there is a similar need for ``megaitems,'' the canvas equivalent of a megawidget. ``Megaitems'' are canvas item types created from more basic canvas item types. Like megawidgets, ``megaitems'' should be indistinguishable from native canvas items so they can be replaced by native canvas items should they become available.

``Megaitems'' would have been invaluable in the implementation of the network topology display. Both the rate meters and the buffer occupancy bars are comprised of several native canvas items. We would have liked to have defined these to be new canvas types (``megaitems'') and then used them in defining a new ``megaitem'' type: the ATM switch. While we did write procedures to abstract the construction of these items, it is clear from the code that they are not native canvas types, and significant sections of code would have to be changed to use a native rate meter item, were it to become available. Incorporating ``megaitem'' support into the Tk canvas would allow the Tcl/Tk programmer to take advantage of the benefits of object-oriented design and would make the Tk canvas more flexible.


next up previous
Next: Conclusion Up: Canvas Improvements Previous: Selection Based on Multiple
Michael Santos
1998-07-27