2

I would like to create a descendant component from TVirtualStringTree and to add few more properties to Columns collection.

The actual structure of TVirtualStringTree is:

+ Header (TVTHeader)
|+ Columns (TVirtualTreeColumns)
 |+ CollectionItem (TVirtualTreeColumn)
  |- Text
  |- Width
  |+ Options
  |- CheckBox
  |- ... Here under [CollectionItem] I would like to add some more properties

Please some support about this topic. Thank you!

Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
REALSOFO
  • 852
  • 9
  • 37

1 Answers1

3

Derive a new class from TVirtualTreeColumn:

type
  TMyTreeColumn = class(TVirtualTreeColumn)
    // add your desired properties as needed...
  end;

Then derive a new class from TVirtualStringTree and override its virtual GetColumnClass() method:

type
  TMyStringTree = class(TVirtualStringTree)
  protected
    function GetColumnClass: TVirtualTreeColumnClass; override;
  end;

function TMyStringTree.GetColumnClass: TVirtualTreeColumnClass;
begin
  Result := TMyTreeColumn;
end;
Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770