Board index » delphi » Howto customize TListColumn in TListColumns?

Howto customize TListColumn in TListColumns?

I would like to add some extra fields to TListColumn, but TListColumns
creates only items of class TListColum.
Can someone help me on this one, please?
 

Re:Howto customize TListColumn in TListColumns?


In article <knE%7.38$235.9...@news.chello.be>, "Drakkar"

Quote
<drakkar_asto...@hotmail.com> writes:
>I would like to add some extra fields to TListColumn, but TListColumns
>creates only items of class TListColum.
>Can someone help me on this one, please?

What do you mean by "extra fields" - do you mean extra columns.

Each Item[] of a TListView has SubItems (which is a TStrings). Each String of
the SubItems is placed in the corresponding TListColumn of the TListColumnS.

To show an extra column of data you have to add a String to the SubItems and
(if there are then more SubItems than Columns) add a TListColumn to the
TListColumnS.

TListColumnS/TListColumn are an implementation of descendants of a
TCollection/TCollecftionItem.

Alan Lloyd
alangll...@aol.com

Re:Howto customize TListColumn in TListColumns?


By extra fields I mean to extend the TListColum object with extra properties
(eg datatype, ....)

Quote
"AlanGLLoyd" <alangll...@aol.com> wrote in message

news:20020112022321.07101.00001177@mb-mn.aol.com...
Quote
> In article <knE%7.38$235.9...@news.chello.be>, "Drakkar"
> <drakkar_asto...@hotmail.com> writes:

> >I would like to add some extra fields to TListColumn, but TListColumns
> >creates only items of class TListColum.
> >Can someone help me on this one, please?

> What do you mean by "extra fields" - do you mean extra columns.

> Each Item[] of a TListView has SubItems (which is a TStrings). Each String
of
> the SubItems is placed in the corresponding TListColumn of the
TListColumnS.

> To show an extra column of data you have to add a String to the SubItems
and
> (if there are then more SubItems than Columns) add a TListColumn to the
> TListColumnS.

> TListColumnS/TListColumn are an implementation of descendants of a
> TCollection/TCollecftionItem.

> Alan Lloyd
> alangll...@aol.com

Re:Howto customize TListColumn in TListColumns?


In article <9OU%7.81$oE6.8...@news.chello.be>, "Drakkar"

Quote
<drakkar_asto...@hotmail.com> writes:
>By extra fields I mean to extend the TListColum object with extra properties
>(eg datatype, ....)

Could you not create descendants of TListColumnS and TListColumn (the latter
with your additional fields) and allocate the instance of TListColumnS
descendant to the ListView.Columns.

Alan Lloyd
alangll...@aol.com

Re:Howto customize TListColumn in TListColumns?


How do you add the descendants of TListColumn to TListColumS ?  Normally the
result of TListColums.Add is a TListColumn.

Quote
"AlanGLLoyd" <alangll...@aol.com> wrote in message

news:20020112101347.01395.00001369@mb-cp.aol.com...
Quote
> In article <9OU%7.81$oE6.8...@news.chello.be>, "Drakkar"
> <drakkar_asto...@hotmail.com> writes:

> >By extra fields I mean to extend the TListColum object with extra
properties
> >(eg datatype, ....)

> Could you not create descendants of TListColumnS and TListColumn (the
latter
> with your additional fields) and allocate the instance of TListColumnS
> descendant to the ListView.Columns.

> Alan Lloyd
> alangll...@aol.com

Re:Howto customize TListColumn in TListColumns?


Quote
Drakkar wrote in message ...
>How do you add the descendants of TListColumn to TListColumS ?  Normally
the
>result of TListColums.Add is a TListColumn.

With Add.

TCollection has a virtual class method that is used by
Add to get the type to instantiate new items from.
TListColumns overrides it to return TListColumn; the
class derived from TListColumns would override it to
return the class derived from TListColumn. Add itself
is static, but it uses a virtual method, so it _will_
adapt its behaviour in a new subclass.

(Read the source to TCollection if you have it.)

Groetjes,
Maarten Wiltink

Re:Howto customize TListColumn in TListColumns?


In article <sPE08.369$503.12...@news.chello.be>, "Drakkar"

Quote
<drakkar_asto...@hotmail.com> writes:
>How do you add the descendants of TListColumn to TListColumS ?  Normally the
>result of TListColums.Add is a TListColumn.

No - what I said (or thought I said <g>) was ...

TMyListColumnS = class(TListColumnS)
   etc etc

TMyListColumn := class(TListColumn)
  etc etc

 MyListColumnS := TMyListColumns.Create(TMyListColumn);
 MyListView.Columns := MyListColumnS;

Perhaps you don't even have to do that ...

Perhaps you can just say ...

 MyListColumnS := TListColumnS.Create(TMyListColumns);
 MyListView.Columns := MyListColumnS;

... or perhaps it won't work that way at all <g>

Alan Lloyd
alangll...@aol.com

Other Threads