Re: tile treeview column numbers and resizing
From: glennh (glennh_at_nospam.glennh.com)
Date: 02/27/05
- Next message: davidhbigelow_at_simplifiedlogic.com: "Re: Mac-address"
- Previous message: Jeff Godfrey: "Re: button scope problem?"
- In reply to: Joe English: "Re: tile treeview column numbers and resizing"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 27 Feb 2005 21:37:53 +0000
Hi Joe.....
I mean programtically. I guess I'm talking about the item text column.
I.e. the left most column where the -text of an inserted item is
displayed.
I don't seem to be able to set the heading for this column.
It's the column where 'abc' is displayed in the script below.
package require tile
ttk::treeview .wtreeResults -columns "col1 col2"
# Set headings for the columns - this names Columns 2 and 3 as seen on
the screen. E.g. the ones where values are displayed.
.wtreeResults heading col1 -text "Column 1"
.wtreeResults heading col2 -text "Column 2"
grid .wtreeResults -row 0 -sticky news
.wtreeResults insert {} end -id item1 -text "abc" -values "123 456 789"
.wtreeResults insert {} end -id item2 -text "some really unusually long
text in here causes overwiting" -values "123 456 789"
update
after 2000
# This expands the first value column - I want to be able to expand the
item text clumn.
.wtreeResults column 0 -width 500
vwait forever
The script also shows the 2nd column (first value) being overwritten by
the first column (text). To deal with this I tried to resize the first
column but as mentioned above the tree widget column 0 seems to be the
second column on the screen.
I hope this helps explain my problem better.
Column sizing could be easier for me if I could specify width as number
of characters.
Also a line wrap option would be good.
e.g:
# Here's the text for my item.
set lText "a long item in the tree"
# Insert the item into the tree.
.wtreeResults insert {} end -id item1 -text $lText -values "123 456 789"
# Resize the item text column to the same width as the item text.
pathname -column 0 -width [string length $lText]
# Alternatively.... Use the default item text column width and wrap the
text if necessary.
pathname -column 0 -wrap true
I have tried putting text with carriage returns in a value column - I
had to escape the quotes for this to work.
See script below:
package require tile
ttk::treeview .wtreeResults -columns "col1"
.wtreeResults heading col1 -text "Column 1"
grid .wtreeResults -row 0 -sticky news
.wtreeResults insert {} end -id item1 -text "abc" -values \"123\n456\n789\"
vwait forever
I hope this helps.
I can carry on playing with ttk::treeview for a while as this is a home
project, not work. Do you expect to be able to make changes in the near
future?
Thanks
Glenn
- Next message: davidhbigelow_at_simplifiedlogic.com: "Re: Mac-address"
- Previous message: Jeff Godfrey: "Re: button scope problem?"
- In reply to: Joe English: "Re: tile treeview column numbers and resizing"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]