AGB  ·  Datenschutz  ·  Impressum  







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

Count tree root nodes

Ein Thema von WojTec · begonnen am 26. Aug 2014 · letzter Beitrag vom 26. Aug 2014
 
Benutzerbild von Sir Rufo
Sir Rufo

Registriert seit: 5. Jan 2005
Ort: Stadthagen
9.454 Beiträge
 
Delphi 10 Seattle Enterprise
 
#3

AW: Count tree root nodes

  Alt 26. Aug 2014, 10:43
You are right that this is very slow and the documentation also stated this Delphi-Referenz durchsuchenTTreeView.Items
http://docwiki.embarcadero.com/Libraries/XE6/en/Vcl.ComCtrls.TTreeView.Items

Note: Accessing tree view items by index can be time-intensive, particularly when the tree view contains many items. For optimal performance, try to design your application so that it has as few dependencies on the tree view's item index as possible.

But there are some methods to walk through the tree:

Get the very first node by calling MyNode := MyTreeView.Items[0]; .
Walk through the tree until you get the desired level with Delphi-Referenz durchsuchenTTreeNode.Next
Delphi-Quellcode:
while Assigned( MyNode ) and ( MyNode.Level <> ALevel ) do
  MyNode := MyNode.GetNext;
Once you got the node at the desired level you can step through all nodes on this level with Delphi-Referenz durchsuchenTTreeNode.GetNextSibling
Delphi-Quellcode:
while Assigned( MyNode ) do
  MyNode := MyNode.GetNextSibling;
Kaum macht man's richtig - schon funktioniert's
Zertifikat: Sir Rufo (Fingerprint: ‎ea 0a 4c 14 0d b6 3a a4 c1 c5 b9 dc 90 9d f0 e9 de 13 da 60)
  Mit Zitat antworten Zitat
 


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 20:50 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz