The Header property of TVirtualStringTree has a Columns property.
Specify your columns in there.
 
Then the OnGetText event has a Column parameter.
 
So you can do something like this in your OnGetText event handler:
 
procedure TFileSelectionDialog.vstFilesGetText(Sender: TBaseVirtualTree;
Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
  var CellText: WideString);
var
  NodeData : PTreeViewNodeData;
begin
  NodeData := Sender.GetNodeData(Node);
 
  CellText := '';
 
  case Column of
    0:  CellText := ExtractFileName(NodeData.Filename);
    1:  begin
          if not NodeData.IsFolder then
            CellText := DateTimeToStr(NodeData.FileDate);
        end;
  end;
end;

This is from when I wrote our own file selection dialog, since the
built-in Delphi one can't cope with more than a certain number of files
(if you're interested in the specifics, IIRC the number of files the
built-in one can cope with is limited to the number of fully qualified
paths which will fit into 32000 bytes or something - it's a problem with
the underlying WinAPI).
 
Hopefully that's enough to get you going.  Ask away if you've got more
questions.
 
HTH,
 
Conor

________________________________

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Ross Levis
 
I think someone mention they were using Virtual TreeView recently.  I
heard that it can be made to look like a standard ListView, so I'm
investigating it to replace a TListView in an app of mine which takes
far too long to load up to 20,000 items.

 

I can't use TListView in virtual mode as it seems way too difficult to
enable sorting on columns which I need.  The Virtual TreeView appears to
handle sorting as easy as TListView does in non-virtual mode.

 

I'm just having difficultly working out how the use the component!  I
realize I need to set up a record for each set of data but I can't work
out how to add columns of data.  The examples are mostly involved with
tree structures.

 

I'm hoping someone can quote for me a basic piece of code for adding say
2 items with 2 or 3 columns.

_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: [email protected]
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe

Reply via email to