Contents
Consider the example of opening the variable in the interface of the modeling container.
Executing the example requires a modeling container with the MS identifier containing a modeling variable with the VARIABLE identifier.
Add links to the Metabase, Ui system assemblies. For the Fore.NET example add a link to the Fore system assembly.
Sub OpenVariable;
Var
Mb: IMetabase;
ObjDes: IMetabaseObjectDescriptor;
Target: IUiCommandTarget;
Begin
MB := MetabaseClass.Active;
// Get modeling variable
ObjDes := MB.ItemByIdNamespace("VARIABLE", MB.GetObjectKeyById("MS"));
// Get an object for executing operations with the variable
Target := WinApplication.Instance.GetObjectTarget(ObjDes);
// Open modeling variable for edit
Target.Execute("Object.Edit", Null);
End Sub OpenVariable;
Imports Prognoz.Platform.Interop.Fore;
Imports Prognoz.Platform.Interop.Ui;
…
Public Shared Sub Main(Params: StartParams);
Var
Mb: IMetabase;
ObjDes: IMetabaseObjectDescriptor;
RunContext: ForeRuntimeContext;
WinApp: WinApplicationClassClass = New WinApplicationClassClass();
Target: IUiCommandTarget;
Begin
MB := Params.Metabase;
// Get modeling variable
ObjDes := MB.ItemByIdNamespace["VARIABLE", MB.GetObjectKeyById("MS")];
// Get an object for executing operations with the variable
RunContext := (MB As IForeServices).GetRuntime().Context;
Target := WinApp.Instance[RunContext].GetObjectTarget(ObjDes);
// Open modeling variable for edit
Target.Execute("Object.Edit", Null, RunContext);
End Sub;
The VARIABLE variable is opened for edit in the interface of the modeling container.
See also: