10020 : Move a GanttTime within a list


We are using phGantTimePackage COM Ver. 3.5.4 using VC+ 6.
Even after reading the documentation thoroughly, I am unclear about moving tree nodes.
I figured how to move a tree node into an other like this:
CphDataEntity_Tree2 m_theSourceTree is the tree item where drag started.

CphDataEntity_Tree2 m_theDestTree is the tree item where drop stopped.

m_theSourceTree.ChangeOwner(m_theDestTree.SubDataList(), m_theDestTree.SubDataList().Count());
I found out how to put a tree item at the end of the list:
  CphDataList_Tree RootTree;
  RootTree = m_ganttchart.GetRootDataEntitiesTree();
  CphDataEntity_Tree2 SoonToBeOldOwner;
  SoonToBeOldOwner = m_theSourceTree.GetParent();
  CphDataList_Tree OwnDatalist = SoonToBeOldOwner.SubDataList();
  m_theSourceTree.ChangeOwner(RootTree, RootTree.Count());
Now, I am wondering how I move a treeitem within the tree. Lets say I want to move a tree item from row 12
to row 4 like Yapp does. My ultimate plan is that, after the drop, I will get a popup menu asking the user where they want to move the source tree item; above, into, under, the node dropped to.
As demonstrated above, I know how to handle the into case. However, I have no clue how to implement the ‘above’ and ‘under’ cases.


You are correct in your description on how to acheive these operations, the only thing you have not found is the IphDataList2.Move(oldind,newind) operation.

If you have a IphDataEntity_Tree and want to move it within its list;   ((typecast to IphDataList2) aTreeNode.OwningDataList).Move(currPos,NewPos);




Leave a Reply