TTMSFMXTreeview Reorder Issue

Hi,


Just encountered an error with the Reorder functionality of a treeview.

Drop a TTMSFMXTreeView on a Form
Fill the Treeview with only top-level items.

// I used some old test-code to show the problem
procedure TForm1.FormCreate(Sender: TObject);
var
  i   : Integer;
  col : TTMSFMXTreeViewColumn;
  pn  : TTMSFMXTreeViewNode;
begin
  TMSFMXTreeView1.Interaction.Reorder := True;

  TMSFMXTreeView1.ClearNodes;
  TMSFMXTreeView1.Columns.Clear;

  col := TMSFMXTreeView1.Columns.Add;

  for i := 1 to 25 do
  begin
    pn         := TMSFMXTreeView1.AddNode;
    pn.Text[0] := IntToStr(i) + ' It has to be a large example text to force the horizontal scrollbar';
  end;

  TMSFMXTreeView1.AutoSizeColumn(0);
end;

Start the application and drag one item to another item.

In some case the error occurs in TTMSFMXCustomTreeView.HandleMouseUp
FDragNode.Node = nil or dn.Node = nil

In other occasions the error is in TTMSFMXTreeViewData.MoveNode
ADestinationNode = nil

Hi, 


We have fixed this issue, the next version will address this.

Ok, Thx.

Any idea when a new version will be released ?

Hi,


Just downloaded the latest version.
The AV seems to be fixed, but the items will only be Reordered.
I can't make an item, the child of another item.

Furthermore an old error seems to be back.
After a reorder drag&drop action, the column is resized and the width becomes too small.

Little panic now.


I just got an Access Violation while reordering items in a tree,
In TTMSFMXCustomTreeView.HandleMouseUp, line 3783.
FDragNode.Node = nil, so the MoveTo causes the error.

       if FDragNode.Level = dn.Level then
          FDragNode.Node.MoveTo(dn.Node.GetParent, dn.Node.Index);
        DoAfterReorderNode(FDragNode, dn);

Because I need to release soon, I will revert the TMS components for now.

BTW,

dn.Node is also nil, so the GetParent and Index would also case an error.

The reorder behavior is by design. Reordering is only within nodes of the same level.

We are not able to reproduce the access violation in your sample. The drag&drop action that checks if dn is assigned should have a Node parameter assigned to it. Please provide more details a sample that demonstrates the behavior.

OK, I will try to make an example for the hierarchy.


What about my remark
Furthermore an old error seems to be back.
After a reorder drag&drop action, the column is resized and the width becomes too small.

The treeview is automatically recalculating columns and nodes during a reorder operation which clears the auto-size operation. You can apply auto-sizing again after a node is reordered in the OnAfterReorderNode event

Sorry Pieter,


I'm not able to reproduce this with a simple example.
We have complex tree-structures build up with data from the database.
I have already spent too much time on this.

I implemented a work-around for the moment.
I always return False for ACanReorder in the BeforeReOrder
and just populate the tree from scratch afterwards.
Not optimal, but works.