MoveTo(FromIndex: Integer; ToIndex: Integer);
FromIndex. Index of the position of the element that must be moved.
ToIndex. Index of the position, to which the element must be moved.
The MoveTo property changes element position in scenario tree.
Sub Main;
Var
MB: IMetabase;
MObj: IMetabaseObject;
ModelSpace: IMsModelSpace;
Tree: IMsScenarioTreeEntries;
Folder: IMsScenarioTreeFolder;
Begin
MB := MetabaseClass.Active;
MObj := MB.ItemById("KONT_MODEL").Edit;
ModelSpace := MObj As IMsModelSpace;
Tree := ModelSpace.ScenarioTree;
Folder := Tree.AddFolder(Folder #1);
Tree.MoveTo(Tree.IndexOf(Folder), 0);
MObj.Save;
End Sub Main;
After executing the example a new folder is created in the tree of modeling container scenarios. This folder is moved to the first position in the list.
See also: