[Lazarus] TTreeNode.MoveTo root node check

David Jenkins david at scootersoftware.com
Mon Jun 10 18:34:26 CEST 2013


We are seeing an error when we do a move of an item at the base of a 
TTreeView.

The particular situation is that with several items in the view a user 
does a rename of an item that moves that item to bottom of the list.  
Debugging the problem we are entering TreeView.TTreeNode.MoveTo() with 
Destination = nil and Mode = nadAddChild and then hit the 
TreeNodeError('TTreeNode.MoveTo Destination = nil) error.

Looking at the code and the definitions for TNodeAttachMode it seems, 
assuming that Destination = nil indicates that you are at root level of 
the TreeView,  the check should be for naAddChild and nadAddChildFirst 
(add a child to the destination i.e to the root node) rather than naAdd 
and naAddFirst (add siblings to destination).  In other words one can't 
add siblings to the root node but should be adding children.

I can enter a bug report and attach a patch for this if it is indeed an 
error.  I wanted to check first that I wasn't misunderstanding the code.

David Jenkins






More information about the Lazarus mailing list