Tcl (was Re: [oclug] UNIX philosophy (was Re: vim rulez...))

David F. Skoll dfs at roaringpenguin.com
Fri Apr 20 14:19:45 EDT 2001


On Fri, 20 Apr 2001, Jonathan Earle wrote:

> You can make lists of lists, which approximate 2D arrays, peel off one of
> the sublists and work with it.  That's not bad in pure Tcl.  When trying to
> integrate Tk to make a table however, the workload soars.  Due to lack of
> proper array handling, trying to represent tabular data, and load / save
> that data to disk means a lot of really ugly work.  Each textbox is an
> individual variable, with a custom built name like:

No, no, ugh!  There are much easier ways to do this.  There is a
TkTable widget which does most of this for you.  If you do not want
any C-language extensions, there are many ways to wrap
widget-name-to-x-y-coordinate mappings and you can make nice little
procedures which do it for you.

I made some little procedures for creating per-window variables, for example,
so each toplevel can have a sort of "namespace" associated with it.  (This
was for a former employee, so I can't give out the code, unfortunately.)

You can do similar things for tabular data.

--
David.




More information about the OCLUG mailing list