Discussion:
TListView columns AutoSizing
(too old to reply)
Christakis John
2005-03-10 03:12:55 UTC
Permalink
Hiya,

I have a TListView in Report view and have set the columns to all be
AutoSize'd. When I populate the list with text that is wider than the
column I get 'first bit...'. I want the column to grow to suit the width of
the widest text in that column so that there are no ...'s - does that make
sense?

I have tried turning off and on the AutoSize and .Repaint and .Refresh and
.Update and all that sort of thing, but it just won't do it. If I double
click the <- -> mouse cursor on the column title it sizes the way I want, so
I know it can be done.

tia,
cj
Maarten Wiltink
2005-03-10 08:29:22 UTC
Permalink
Post by Christakis John
I have a TListView in Report view and have set the columns to all be
AutoSize'd. When I populate the list with text that is wider than the
column I get 'first bit...'. I want the column to grow to suit the
width of the widest text in that column so that there are no ...'s -
does that make sense?
Sure. In a program I inherited, it's about forty lines of code.
Start with TCanvas.TextWidth, work from there. You can do it.

Groetjes,
Maarten Wiltink
Peter
2005-03-10 08:59:00 UTC
Permalink
Hi

Just set the width of the columns, you want to be autosized to -2
That's all!

Peter
Post by Christakis John
Hiya,
I have a TListView in Report view and have set the columns to all be
AutoSize'd. When I populate the list with text that is wider than the
column I get 'first bit...'. I want the column to grow to suit the width of
the widest text in that column so that there are no ...'s - does that make
sense?
I have tried turning off and on the AutoSize and .Repaint and .Refresh and
.Update and all that sort of thing, but it just won't do it. If I double
click the <- -> mouse cursor on the column title it sizes the way I want, so
I know it can be done.
tia,
cj
Marc Rohloff
2005-03-10 16:31:48 UTC
Permalink
Post by Christakis John
I have a TListView in Report view and have set the columns to all be
AutoSize'd. When I populate the list with text that is wider than the
column I get 'first bit...'. I want the column to grow to suit the width of
the widest text in that column so that there are no ...'s - does that make
sense?
IIRC, you need to set the autosize after populating the view.

--
Marc Rohloff

Loading...