BindToObject(RealObject: Object): IForeObject;
BindToObject(RealObject: Object): Prognoz.Platform.Interop.Fore.IForeObject;
RealObject. Custom class instance.
The BindToObject method provides access to custom class instance.
The method does not support work with system class instances available in development environment system assemblies.
Add a link to the Fore, Metabase system assembly.
Sub ShowObject(Obj: Object);
Var
Runtime: IForeRuntime;
ClassInst: IForeObject;
Field: IForeVar;
c, i: Integer;
Begin
Runtime := (MetabaseClass.Active As IForeServices).GetRuntime;
//Get custom class instance
ClassInst := Runtime.BindToObject(Obj);
//View field values
c := ClassInst.FieldsCount;
For i := 0 To c - 1 Do
Field := ClassInst.FieldItem(i);
Debug.WriteLine(Field.Name + " : " + Field.Value);
End For;
End Sub ShowObject;
Imports Prognoz.Platform.Interop.Fore;
Imports Prognoz.Platform.Interop.Metabase;
Sub ShowObject(Mb: IMetabase; Obj: Object);
Var
Runtime: IForeRuntime;
ClassInst: IForeObject;
Field: IForeVar;
c, i: Integer;
Begin
Runtime := (Mb As IForeServices).GetRuntime();
//Get custom class instance
ClassInst := Runtime.BindToObject(Obj);
//View field values
c := ClassInst.FieldsCount();
For i := 0 To c - 1 Do
Field := ClassInst.FieldItem(i);
System.Diagnostics.Debug.WriteLine(Field.Name + " : " + Field.Value);
End For;
End Sub;
The specified procedure enables getting information about field values of custom classes instances.The class instance is sent as procedure input parameter, the field values are displayed to the development environment console.
See also: