[DUG] Soft-Gems Virtual TreeView for a ListView

Ross Levis ross at stationplaylist.com
Thu Nov 15 17:22:09 NZDT 2007


Thanks for code.  That has helped a lot.

 

Cheers,

Ross.

 

From: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz] On
Behalf Of Jianming Lin (FMI)
Sent: Thursday, 15 November 2007 10:15 a.m.
To: NZ Borland Developers Group - Delphi List
Subject: RE: [DUG] Soft-Gems Virtual TreeView for a ListView

 

//The most concise version I can make is as follows:

//See also attached Zip file

//=======================================

 

type

  TfrmVTColumns = class(TForm)

    VTColumns: TVirtualStringTree;

    procedure VTColumnsGetText(Sender: TBaseVirtualTree; Node: PVirtualNode;
Column: TColumnIndex; TextType: TVSTTextType; var CellText: WideString);

    procedure FormCreate(Sender: TObject);

  private

    //

  public

    //

  end;

 

var frmVTColumns: TfrmVTColumns;

 

                                         implementation

//--------------------------------------------------------------------------
--------------------------------------------

{$R *.dfm}

 

 

type

  PGridData = ^TGridData;

  TGridData = record

    Value: array[0..2] of Variant;

  end;

 

 

//you can also fill data on InitNode event

//--------------------------------------------------------------------------
--------------------------------------------

procedure TfrmVTColumns.FormCreate(Sender: TObject);

var vNode : PVirtualNode;

    Data: PGridData;

begin

  VTColumns.NodeDataSize := SizeOf(TGridData);

 

  vNode := VTColumns.GetFirst;

  While vNode <> nil do begin

    Data := VTColumns.GetNodeData(vNode);

    Data.Value[0] := Variant(vNode.Index);

    Data.Value[1] := 'Apple';

    Data.Value[2] := Date;

 

    vNode := VTColumns.GetNext(vNode);

  end;

 

end;

 

//--------------------------------------------------------------------------
--------------------------------------------

procedure TfrmVTColumns.VTColumnsGetText(Sender: TBaseVirtualTree; Node:
PVirtualNode; Column: TColumnIndex;

  TextType: TVSTTextType; var CellText: WideString);

var Data: PGridData;

begin

  if Column > 0 then begin

    Data := Sender.GetNodeData(Node);

    CellText := Data.Value[Column - 1];

  end else

    CellText := '';

end;

 

  _____  

From: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz] On
Behalf Of Ross Levis
Sent: Monday, 12 November 2007 3:50 p.m.
To: 'NZ Borland Developers Group - Delphi List'
Subject: [DUG] Soft-Gems Virtual TreeView for a ListView

 

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.

 

Many Thanks,

Ross.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.adventureeducation.co.nz/pipermail/delphi/attachments/20071115/740d82cb/attachment.html


More information about the Delphi mailing list