Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/VCLX/TTreeView    [ Add a report in this area ]  
Report #:  4434   Status: Reported
TTreeNodes.Insert breaks double linked list of TTreeNode
Project:  Delphi Build #:  4.453
Version:    7.0 Submitted By:   Martin Suer
Report Type:  Basic functionality failure Date Reported:  5/14/2003 8:21:19 AM
Severity:    Serious / Highly visible problem Last Updated: 5/14/2003 2:04:38 PM
Platform:    All platforms Internal Tracking #:  
Resolution: None  Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: (3 Total Ratings)
4.33 out of 5
Total Votes: 1
Inserting a new TreeNode in a TTreeView breaks the double linked list of TreeNodes that is contained in the TreeView.

After Inserting a TreeNode, the FPrevItem of the TreeNode following the inserted Node doesn't point to the inserted Node and the FNextItem of the inserted Node doesn't point to the following node but is nil.

Therefore multiple Inserts of TTreeNodes at the same Position won't work correctly but nodes are inserted in a wrong order.
Steps to Reproduce:
use TTreeNodes.Add and then TTreeNodes.MoveTo(destination,naInsert)

The following change in the CLX will fix the problem

Excerpt from  Unit QComCtrls:

constructor TCustomViewItem.Create(AOwner: TCustomViewItems; AParent, After: TCustomViewItem);
  inherited Create;
  FOwner := AOwner;
  FParent := AParent;

// (Martin Suer) CLX-Fehler Patch  
  if Assigned(After) then          
    FNextItem := After.FNextItem;  
  if Assigned(FNextItem) then      
    FNextItem.FPrevItem := self;    
// ---------------------------------

  FPrevItem := After;
  if Assigned(FPrevItem) then
    FPrevItem.FNextItem := Self;
  FImageIndex := -1;
  FSelectable := True;
  FExpandable := False;
  FStates := [isNone];

  if Assigned(Owner) then
    CreateWidget(AParent, After);


Server Response from: ETNACODE01