IndexOf(Value: IMsScenarioTreeEntry): Integer;
Value. Element of the scenario tree, index for which must be obtained.
The IndexOf method returns element index 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: