AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

VirtualTreeString AddChild

Ein Thema von sdean · begonnen am 10. Dez 2010
Antwort Antwort
sdean

Registriert seit: 5. Dez 2009
64 Beiträge
 
#1

VirtualTreeString AddChild

  Alt 10. Dez 2010, 21:30
Delphi-Version: 7
Hi , i've this code to populate a Tree :
Delphi-Quellcode:
type
  PMyList = ^AList;
  AList = record
    FileName:String;
    Dir:String;
  end;

{
If there are many Files with same extension than
don't create a new Father for each , But rather gather
them under One Father :

EXE
|_1.exe
|_2.ex
.....
NOT --------------
EXE
|_1.exe
EXE
|_2.exe
------------------
}

function FindRootNode(const ATvNodeText: String): TTreeNode;
var
  I: Integer;
begin
  Result := nil;
  for I := 0 to form1.tv.Items.Count - 1 do
    if form1.tv.Items[I].Level = 0 then
      if form1.tv.Items[I].Text = ATvNodeText then
      begin
        Result := form1.tv.Items[I];
        Break;
      end;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
i,j:Integer;
ARecord1,ARecord2: PMyList ;
tvNode:TTreeNode;
begin
 for i:=MyFilesList.Count-1 downto 0 do begin
 for j := (MyFilesList.Count -1) downto (i + 1) do

if PMyList(MyFilesList.Items[i])^.FileName=PMyList(MyFilesList.Items[j])^.FileName then begin
 ARecord1:= MyFilesList.Items[i];
 ARecord2:= MyFilesList.Items[j];
 MyFilesList.Remove(ARecord1);


tvNode:= FindRootNode(ExtractFileExt(ARecord1^.FileName));
   if tvNode= nil then
tvNode:=tv.Items.Add(nil,ExtractFileExt(ARecord^.FileName));
tv.Items.AddChild(tvNode,ARecord1^.FileName);
tv.Items.AddChild(tvNode,ARecord2^.FileName);
end;
end;
end;
My Question is how to replace TreeView with VirtualTreeString with same tv addChild routine .

many thanks .
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 18:48 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz