[DUG] Soft-Gems Virtual TreeView for a ListView

Ross Levis ross at stationplaylist.com
Mon Nov 12 16:42:34 NZDT 2007


Thanks for that.  I think I get it now.  If I define 5 columns in the
Columns property then the component will call the OnGetText event 5 times
for each line (node).

 

I just have to work out what NodeData := Sender.GetNodeData(Node) does but
there are examples for this so I should be right, thanks.

 

Ross.

 

From: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz] On
Behalf Of Conor Boyd
Sent: Monday, 12 November 2007 4:06 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: RE: [DUG] Soft-Gems Virtual TreeView for a ListView

 

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: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz] 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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.adventureeducation.co.nz/pipermail/delphi/attachments/20071112/6e03a474/attachment-0001.html


More information about the Delphi mailing list