WHAT: mclistbox v1.00b1, a pure tcl multicolumn listbox widget
REQUIREMENTS: tcl/tk 8.0 or greater (8.0.3 recommended)
SUPPORTS: all platforms supported by tcl 8.x
WHAT'S NEW IN THIS RELEASE:
* Everything! This is the first public version. As such, expect
* multiple columns, each which may have its own foreground and
background colors (and fonts, with a caveat), and which may
be visible or invisible.
* column headers, which may be turned on or off. Headers may
have fonts, colors and borders distinct from the columns
* scrollable -- the width of all of the columns may exceed the
size of the container; the view can be adjusted using normal
methods (ie: by attaching scrollbars)
* a -selectcommand option, which will run a command whenever
the selection changes. Doing something when the selection
changes seems to be something a lot of beginners stumble
over; this feature is an attempt to alleviate that to some
* written in pure tcl. Nothing more to download or install.
* completely, totally, free. I retain copyright but you are
free to use the code however you see fit. Don't be mean.
* fully cross-platform. Works on Macintosh, Unix, and other
more inferior operating systems :-)
* an API that is a superset of the standard listbox (for a low,
low double-yer-money-back-guarantee learning curve)
* I'm not sure if the option database code is working right; I'm
not really up to speed on how best to use it.
* if you use different fonts for different columns, if those
fonts don't have the same line height the data will not line
up properly. There is no workaround other than to use fonts
with the same height.
* there is very little error checking of input values in the
* the code hasn't been optimized at all.
* the columns are not currently resizable using the mouse
A couple of questions, if you will
1. Is this multicolumn listbox suitible for "long lists", say 20,000
2. Would it be practical to convert the headers to buttons or button
so that they could trigger sorts?
3. On my 2 win95 systems I notice that keystrokes are completely
for ANY Tk listboxes ,including the multicolumn. From Brent Welch's book
it appears that the default bindings should support keystroke actions.
a bug or am I missing some special steps to get listbox keystrokes
Kinda depends on your system. It can become rather slow to insert that
many items on my system (PII 266) if added one at a time. Adding them in
a chunk is quite doable. For example, I just inserted 20k rows. Doing
them one at a time took around 20 seconds; doing them with a single
insert command took around 6. That's not too bad. Your mileage may vary.
The absolute best way to answer a question like this is to try it
> 2. Would it be practical to convert the headers to buttons or button
> so that they could trigger sorts?
I'm working on that now. They are staying as labels, but you'll be able
to bind events to them. The example will ultimately show how to sort the
columns with a click on a header. I have it working, but it may be this
weekend before I post it to the net. There will also be the ability to
resize the columns using the mouse. I have that working now, too, but
the code is kinda gross and needs some cleaning up.
> 3. On my 2 win95 systems I notice that keystrokes are completely
> for ANY Tk listboxes ,including the multicolumn. From Brent Welch's book
> it appears that the default bindings should support keystroke actions.
> Is this
> a bug or am I missing some special steps to get listbox keystrokes
The listbox must have keyboard focus. By default it doesn't, and by
default clicking in them (at least on windows) doesn't set the focus
(anyone know if this is a bug or expected behavior?). You should be able
to press Tab or do a [focus .whatever] to get keyboard focus set to the
listbox. Once that happens, keystrokes work fine.
> Roy Terry wrote:
> > This is a great thing. Thank you. I look forward to learning some Tk
> > coding skills from this source.
> The listbox must have keyboard focus. By default it doesn't, and by
> default clicking in them (at least on windows) doesn't set the focus
> (anyone know if this is a bug or expected behavior?). You should be able
> to press Tab or do a [focus .whatever] to get keyboard focus set to the
> listbox. Once that happens, keystrokes work fine.
From my use of windows if clicking directly on something doesn't give
it the input focus then that something isn't working right by Windows
I eagerly await your next revision and I'll send results of my own trials.
>From my use of windows if clicking directly on something doesn't give
>it the input focus then that something isn't working right by Windows
i found it usually meant something *else* wasn't working right, and Doze was
too wussy to take focus from it.