- text and canvas are powerhouses.
- tags are incredibly effective. The real question here is why no other toolkit has adopted tags to such good effect.
ulis 2002-01-08:It is possible -and easy- to write some megawidgets entirely with Tcl and Tk. An example is Hugelist [1] which implements a list box that can handle more than 1,000,000 items without CPU or memory penalties.For how this is possible, see: Mass-widget.
Yes, ulis, that's what the previous contributor said - that megawidgets can be written in Tcl/Tk. But that to create unique new widgets , one needs to go to C code because Tcl does not, at the script level, exposure APIs for generating the appropriate X transactions.ulis 2002-01-09:OK. What are these X transactions and why are they needed? (For my megawidgets I needed no more than Tcl & Tk commands)unknown: Well, why do you think the high performance graphing widgets of BLT are written in C? What about the 'Vu' widgets? All of these things could (probably) be written in Tcl by manipulating lines and pixels on the canvas widget, but that would not be very practical.ulis: Hmm... Performance is complex and not the prerogative of C. A careful design can make megawidgets in plain Tcl/Tk behave more faster than C widgets (under some circumstances). For example, the Hugelist can load, move and resize 1000 times faster than the Tk Listbox when 1,000,000 items are involved. I conclude that all two possibilities are useful.DKF 2003-01-09:The main thing that you can't do with Tk as it currently stands is clipping (to anything other than the window.) If you could define an area (rectangular or otherwise) within which an object is drawn, then you'd be able to synthesize virtually any widget using a canvas. Well, maybe it'd take extra work to get things like focus and binding handling working nicely, but it'd be possible to fix them. It is clipping that is the major operation that is missing.BTW, Swing uses a sophisticated drawing model on top of what is effectively a canvas - though a canvas without all Tk's nifty features, to build itself on top of the basic display primitives offered by AWT, so it can be done. Mind you, Java2D - the drawing layer used by Swing - is a slow pig unless your computer is unreasonably chunky...AMG: The Swing drawing model is very low level. Widgets need to provide code for redrawing themselves on Expose-type events. For an old example (probably not compatible with new versions of Java), look at the custom widgets (Chart, My*) in my rlemonitor program [2]. I might move the URL someday; if this link breaks please fix it or remind me to do so. For a screenshot see http://ioioio.net/screenshots/app/rlemonitor.png
![](/ext.png)