package require Tk 8.5
proc main {} {
ttk::style layout FlatTree {
Treeview.padding -sticky nsew -border 0 -children {
Treeview.treearea -sticky nswe -border 0 -expand true
}
}
ttk::frame .f
pack .f -side top -fill both -expand true -padx 10 -pady 10
ttk::treeview .tree \
-style FlatTree \
-show tree
pack .tree -in .f -side top -fill both -expand true
set parent [.tree insert {} end -text Root -open true]
.tree insert $parent end -text One
.tree insert $parent end -text Two
.tree insert $parent end -text Three
}
main
--
Bryan Oakley
http://www.tclscripting.com
What do you find unsatisfactory about it?
It looks to me like it does what you want (no border),
the only thing I see wrong is that the fill color behind
items doesn't match that of the blank region below.
Haven't tested on Windows, is it only a problem there?
I'd also suggest using "Flat.Treeview" as the style name
instead of "FlatTree"; the former will inherit all the
other Treeview settings (and there are plenty) defined
in the theme.
--Joe English
When there aren't enough items in the treeview to fill the widget, the
area below the last item takes a different background color.
> It looks to me like it does what you want (no border),
> the only thing I see wrong is that the fill color behind
> items doesn't match that of the blank region below.
Bingo. Oddly, with the border, the border fills the whole region and the
background looks fine. When I turn the border off, that's when I get the
blank region below which is highly undesireable.
>
> Haven't tested on Windows, is it only a problem there?
>
I think so. Last I recall, it looked find on my mac when I was creating
it. A week or two passed, I tried running it on windows, and that's when
I noticed it didn't look right. I haven't tried it on *nix.
> I'd also suggest using "Flat.Treeview" as the style name
> instead of "FlatTree"; the former will inherit all the
> other Treeview settings (and there are plenty) defined
> in the theme.
Thanks for the hint.