TreeView drag and drop is an area that received a lot of attention and improvement in the recently released Cincom® ObjectStudio® 8.4.
In prior releases it was too easy to get into trouble when dragging and dropping items or subtrees between two different TreeViewCtrls. There was a cluster of ARs on this topic, so we decided to take all of them into account at the same time and really rework this area. Here is a list of the related ARs closed for 8.4:
55761 Dropping a dragged item from a treeview on a blank area of the treeview gives an unhandled exception
58126 Drag/Drop between two TreeViews throws an UHE: Message not understood: #listIndex
58168 TreeView-Option “Allow Drag” does not work (or erroneous)
58346 Drag and drop treeview nodes between different treeviews
60642 TreeView Sub-nodes disappear after inserting a node in subnode and collapsing current node
64519 The method TreeViewNode>>deepSortUsing: does not work in ObjectStudio8
65148 Dropping a treeview node on empty space in another treeview causes duplicate nodes
65149 TreeViewCtrl: use #copyTreeStructure instead of #deepCopy, and create >>copyContentsTo: to copy full contents to another treeview
65185 Dropped node should keep current state (expanded, collapsed) in new treeview
65212 TreeViewCtrl>>removeNode: should use identity comparison to remove the exact specified node and not a similar one
65237 Copying nodes from one to another TreeviewCtrl lost open subnodes below level two
You’ll find some new, interesting protocol as you’re browsing code related to this, especially in the FormTreeView, TreeViewCtrl and TreeViewNode classes. We always recommend that you carefully review any method overrides you have when updating to a new release, and in regard to this topic you should look particularly closely at your overrides to methods in those classes. There is one significant change in semantics to note as well: the methods >>expand: and >>expandAt: used to actually mean ‘toggle the expanded/collapsed state.’ If you sent #expand: to a treeview that was already expanded, it would collapse. In ObjectStudio 8.4, that behavior is now in the >>toggle: / >>toggleAt: methods. See the release notes for 8.4 for more detail.
For those of you doing drag and drop between treeviews in ObjectStudio, we hope you see significant improvement in 8.4, and as always, we look forward to your feedback.