Search code examples
delphivirtualtreeviewtvirtualstringtree

TVirtualStringTree: What is Column parameter in OnGetText event?


The OnGetText event procedure definition is:

TVSTGetTextEvent = procedure (Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType; var CellText: UnicodeString) of object;

The documentation CHM help file for this event just says:

Use other resources like the news group or the Delphi Gems message board to find a description.

I've seen some other posts on SO where they are checking for (Column < 0) in this event, so I'm curious about what this is?

FWIW, I'm trying to implement a Parent-Child tree view from database data.


Solution

  • You can define columns in the virtual tree's Header.Columns collection. The Column parameter that is passed to any event method where it's given, is the 0 based index of the column in this collection.

    The Column parameter value can be either the 0 based index of the processed column, or NoColumn (which has internally value -1), which indicates that there is no column in your virtual tree.