|
From: Joe E. <jen...@fl...> - 2006-05-27 16:10:37
|
Bryan Oakley wrote:
> It seems impossible to create a treeview that has one invisible data
> column. Or am I missing something?
> [...] this gives me two columns with two visible (the tree column and one
> data column)
>
> ttk::treeview .tv2 -columns {foo} -displaycolumns {}
>
> That is because a -displaycolumn that is the empty string is synonymous
> with "show all rows". It seems to be impossible to have a condition
> where you want none of the data columns visible.
Apparently not; this was an oversight.
I can think of a couple solutions: (a) Extend the "-show" option
with a third option; "-show {tree headings columns}" would be the
new default value, and "-show tree" (or "-show {tree headings}")
would hide all columns; or (b) make -displaycolumns have a NULL
default value, interpret NULL as "show all columns" and the empty
list as "show no columns".
(a) is not backwards-compatible (existing programs that specify
both "-show" and "-columns" would need to add "columns" to the
-show list), and (b) is a Bad Idea (there's no way for scripts
to specify a NULL value).
Any other ideas?
(On a related note: if it does become necessary to make a
backward-incompatible change, there's one more I'd like to
make at the same time: right now there's no easy way to
distinguish a child of the root element from a detached
item; [$tv parent $item] returns {} for both cases.)
> I discovered that I can add an item and give it values for more columns
> than it has configured, though I'm wondering if that's a feature or a bug:
>
> ttk::treeview .tv3 -columns {}
> .tv3 insert "" end -values {"hidden value"} -text "visible value"
>
> Is it kosher to be able to supply more values than there are columns? I
> see no other way to get the desired effect.
That behavior isn't explicitly documented, but it will work.
--Joe English
jen...@fl...
|