Board index » cppbuilder » TListView with multi line and multi column

TListView with multi line and multi column


2008-05-13 07:24:03 AM
cppbuilder45
Hi:
I am trying to display some information in a TListBox. I need to have
multi columns and I need to be able to put multiple line of text in a
sinlgle item.
I cannot use the TListView because it does not support the Multi line
and there is no OnMeasureItem to set the height of each item. So I
decided to use the TListBox with Style property set to
lbOwnerDrawVariable and a THeaderControl to achive my goal. The first
time the text is displayed everything works fine. But if I try to
resize one of the columns, I cannot get the TListBox to re-measure
each item. I have tried using Repaint(), Refresh() and Invalidate()
none of which has worked. Any Ideas?
Useing BDS 2007
 
 

Re:TListView with multi line and multi column

Hi:
I am trying to display some information in a TListBox. I need to have
multi columns and I need to be able to put multiple line of text in a
single item.
I cannot use the TListView because it does not support the Multi line
and there is no OnMeasureItem to set the height of each item. So I
decided to use the TListBox with Style property set to
lbOwnerDrawVariable and a THeaderControl to achieve my goal. The
first
time the text is displayed everything works fine. But if I try to
re-size one of the columns, I cannot get the TListBox to re-measure
each item. I have tried using Repaint(), Refresh() and Invalidate()
none of which has worked. Any Ideas?
Using BDS 2007
 

Re:TListView with multi line and multi column

Hi:
I am trying to display some information in a TListBox. I need
to have multi columns and I need to be able to put multiple
line of text in a single item.
I cannot use the TListView because it does not support the
Multi line and there is no OnMeasureItem to set the height of
each item. So I decided to use the TListBox with Style property
set to lbOwnerDrawVariable and a THeaderControl to achieve my
goal. The first time the text is displayed everything works
fine. But if I try to re-size one of the columns, I cannot get
the TListBox to re-measure each item. I have tried using
Repaint(), Refresh() and Invalidate() none of which has worked.
Any Ideas?
Using BDS 2007
 

{smallsort}

Re:TListView with multi line and multi column

"Sam" < XXXX@XXXXX.COM >wrote in message
Quote
The first time the text is displayed everything works fine.
But if I try to re-size one of the columns, I cannot get the
TListBox to re-measure each item.
Unlike other owner-drawn controls, ListBox controls do not fire measure
events more than once per item. Once an item is put into the ListBox, it is
measured once and then the size is remembered for the lifetime of the item.
I once had the same problem you are having. I needed to have per-item font
sizes that could change dynamically, and thus needed to re-adjust item
heights dynamically. The only solution I could come up with to force
re-measuring was to delete and re-add each item when its height needed to
change. In this situation, you might be able to get away with a simple
RecreateWnd() call instead, since you want to update all items in a single
go.
Gambit