IForeNETRuntimeMethodArgs.ValueObject
Syntax
ValueObject(Index: Integer): IForeNETRuntimeObject;
Parameters
Index. Index of the argument for which value must be specified.
Description
The ValueObject property determines the object, passed as value of specified argument.
Comments
Either the object received from any .NET assembly, or the object being a result of execution of any .NET method after conversion with the IForeNETRuntime.VariantToObject method, could be specified as the value of this property. The object should have a type with which the binding, used while overloaded method search in the IForeNETRuntimeType.Method property, is set.
Example
Executing this example requires a form with the Button1 button and the NetControlBox component named NetControlBox1. Class object System.Windows.Forms.RichTextBox is created in the NetControlBox1 component.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
Run: IForeNETRuntime;
Asm, Asm1, Asm2: IForeNETRuntimeAssembly;
Typ0, Typ1, Typ2: IForeNETRuntimeType;
Typ2Inst: IForeNETRuntimeObjectInstance;
Arg: IForeNETRuntimeMethodArgs;
Bin: IForeNETRuntimeMethodBinding;
Meth: IForeNETRuntimeMethod;
Obj: IForeNETRuntimeObject;
v: Variant;
Begin
Run := ForeNETAssemblyClass.Runtime;
//Create component RichTextBox
Asm := Run.SystemAssembly("System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
Asm1 := Run.SystemAssembly("mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=969db8053d3322ac");
Asm2 := Run.SystemAssembly("System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
//Get point coordinates
v := NetControlBox1.Control.InvokeMethod("GetPositionFromCharIndex", 3);
Obj := Run.VariantToObject(v);
Typ0 := Asm1.Type("System.String");
Typ1 := Asm.Type("System.Windows.Forms.IWin32Window");
Typ2 := Asm.Type("System.Windows.Forms.ToolTip");
Typ2Inst := Typ2.CreateInstance;
//Create connection for search of overloaded method Show
Bin := Run.CreateBinding(3);
Bin.Types.Item(0) := Typ0;
Bin.Types.Item(1) := Typ1;
Bin.Types.Item(2) := Asm2.Type("System.Drawing.Point");
//Get the Show method
Meth := Typ2.Method("Show", Bin);
//Create arguments for displaying tooltip
Arg := Meth.CreateArgs;
Arg.Value(0) := "Tooltip";
Arg.Value(1) := NetControlBox1.Control;
Arg.ValueObject(2) := Obj;
//Execute the Show method
Meth.Invoke(Typ2Inst, Arg);
End Sub Button1OnClick;
After executing this example, at pressing the button the context of three specified assemblies is received. These assemblies are required to output the tool tip to the area of the RichTextBox component. The GetPositionFromCharIndex method is executed for the RichTextBox component to receive a point, in which the tooltip is displayed. The method returns the object of the System.Drawing.Point class. The object is passed as the value of argument into the Show method. The Show method is called after setting the binding for search of method and of list of arguments, that are required to execute the method.
See also:
IForeNETRuntimeMethodArgs