MoveToParent(Parent: IMsScenarioTreeEntries; Index: Integer);
Parent. Parent scenario tree.
Index.Position to which the element should be moved.
The MoveToParent property changes element position in scenario tree.
Executing the example requires that the repository contains a modeling container with the OBJ_CONT identifier.
Sub Main;
Var
Mb: IMetabase;
ModelSpace: IMsModelSpace;
Tree: IMsScenarioTreeEntries;
TreeEntries: IMsScenarioTreeEntry;
Begin
Mb := MetabaseClass.Active;
ModelSpace := Mb.ItemById("OBJ_CONT").Edit As IMsModelSpace;
Tree := ModelSpace.ScenarioTree;
TreeEntries := Tree.Item(Tree.Count - 1);
TreeEntries.MoveToParent(Tree, 0);
(ModelSpace As IMetabaseObject).Save;
End Sub Main;
After executing the example the last element of the scenario tree is moved to its initial position.
See also: