Board index » cppbuilder » Set the column width of the ListView

Set the column width of the ListView


2004-04-19 10:52:47 AM
cppbuilder100
My ListView Object has 2 columns.
When I increase the ListView 's column width in the Form Editor
and then run the program, there is no width change
Also, I can't find any column width related property in the ListView
How can I do it?
 
 

Re:Set the column width of the ListView

"LV" < XXXX@XXXXX.COM >wrote in message news: XXXX@XXXXX.COM ...
Quote
When I increase the ListView 's column width in
the Form Editor and then run the program, there is
no width change
Changing the widths visually in the form editor has no effect on the Width
property that is stored in the DFM.
Quote
Also, I can't find any column width related property in the ListView
You have first to open the Columns editor before you can see the Width
property on the individual columns. Either double-click on the Columns
property in the Object Inspector, or alternatively right-click on the
ListView itself and choose "Columns Editor" from the popup menu.
Gambit
 

Re:Set the column width of the ListView

thx, it works
"Remy Lebeau (TeamB)" wrote:
Quote
"LV" < XXXX@XXXXX.COM >wrote in message news: XXXX@XXXXX.COM ...

>When I increase the ListView 's column width in
>the Form Editor and then run the program, there is
>no width change

Changing the widths visually in the form editor has no effect on the Width
property that is stored in the DFM.

>Also, I can't find any column width related property in the ListView

You have first to open the Columns editor before you can see the Width
property on the individual columns. Either double-click on the Columns
property in the Object Inspector, or alternatively right-click on the
ListView itself and choose "Columns Editor" from the popup menu.

Gambit
 

{smallsort}

Re:Set the column width of the ListView

On Mon, 19 Apr 2004 10:23:16 +0800, LV wrote:
Quote
My ListView Object has 2 columns.
When I increase the ListView 's column width in the Form Editor
and then run the program, there is no width change
Also, I can't find any column width related property in the ListView

How can I do it?
and in my efforts to educate the world as regards list views could you
consider using the following handy function in your programs please:
void General_AutoSizeTListViewColumns( TListView * ListView )
{
for( int index=0;
index<ListView->Columns->Count;
++index )
{
ListView->Columns->Items[ index ]->Width=ColumnTextWidth;
ListView->Columns->Items[ index ]->Width=ColumnHeaderWidth;
}
}
Two things I hate in applications (and see so often):
* List views that don't automatically size their columns.
* Large numbers without thousands separators.
This message was brought to you by the "Oh my gawd, not again" campaign :)
--
Andrue Cope
[Bicester UK]
 

Re:Set the column width of the ListView

Quote
Also, I can't find any column width related property in the ListView
How can I do it?
TCustomListView, the ancestor component for TListView, defines a property
called 'Column' of type TListColumn. If you look up TListColumn in the
online help, you will see that it contains a property called 'Width' which
you can use to resize the column at run-time. Also note that a value of -1
resizes the column to fit the text in the column, and -2 resizes the column
to fit the text in the column header.
Hope this helps.
Regards,
Martin Nijhoff