Registriert seit: 5. Jul 2006
Ort: Magdeburg
8.276 Beiträge
Delphi 10.4 Sydney
|
Re: TVirtualStringTree -> TStringGrid
13. Feb 2009, 21:01
Hallo,
habe gerade selber eine Lösung hinbekommen.
Trotzdem Danke
Heiko
Delphi-Quellcode:
class procedure TListViewToolClass.LVToGrid(
theListView: TVirtualStringTree; theStringGrid: TStringGrid);
var
iCurCol : Integer;
iCurRow : Integer;
Node : PVirtualNode;
sText : UnicodeString;
begin
theStringGrid.ColCount:= theListView.Header.Columns.Count;
theStringGrid.RowCount:= theListView.RootNode.ChildCount+1;
for iCurCol:= 0 to theListView.Header.Columns.Count-1 do
begin
theStringGrid.Cells[iCurCol, 0]:= theListView.Header.Columns[iCurCol].Text;
Node:= NIL;
for iCurRow:= 0 to theListView.RootNodeCount-1 do
begin
if iCurRow=0 then
begin
Node:= theListView.RootNode.FirstChild;
end
else
begin
Node:= Node.NextSibling;
end;
if Assigned(theListView.OnGetText) then
begin
theListView.OnGetText(theListView, Node, iCurCol, ttNormal, sText);
theStringGrid.Cells[iCurCol, iCurRow+1]:= sText;
end;
end;
end;
end; { TListViewToolClass.LVToGrid }
Heiko
|
|
Zitat
|