2

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.

Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
Steve F
  • 1,527
  • 1
  • 29
  • 55

1 Answers1

4

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.

TLama
  • 75,147
  • 17
  • 214
  • 392
  • In what case is (Column < 0) ? I'm not using Header.Columns (grid layout), but a proper tree-view layout. – Steve F Mar 31 '15 at 08:33
  • 1
    In case when you have no columns in your virtual tree. But that test is wrong. It should have been `if Column = NoColumn then`. Generally, if you have no columns in your tree, you don't need to test this parameter at all. – TLama Mar 31 '15 at 08:43
  • And A Column object's `Position` property is the run-time position of that column, because the user might use drag-and-drop to re-order the columns. – Edwin Yip Oct 11 '19 at 04:25