Thanks for code. That has helped a lot.
Cheers, Ross. From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 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.
_______________________________________________ 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
