Create(DispId: Integer; Params: Array);
DispId. Identifier of the event that should be generated for the object loaded in OleDocumentBox.
Params. The collection of parameters of the event that will be generated for the object loaded in OleDocumentBox.
The Create constructor creates an argument that describes an event that should be generated for the object loaded in OleDocumentBox.
Executing the example requires a form, a button named Button1 on the form and the OleDocumentBox component named OleDocumentBox1. A Microsoft Excel sheet is loaded to the OleDocumentBox component.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
Arg: IOleDocumentBoxEventArgs;
Params: Array Of Variant;
Ole, Sheet, Range: Variant;
Begin
Ole := OleDocumentBox1.OleObject;
Sheet := Ole.GetProperty("Application").GetProperty("ActiveSheet");
Range := Ole.GetProperty("Application").GetPropertyEx("Range", "A1");
Params := New Variant[2];
Params[0] := Sheet;
Params[1] := Range;
Arg := New OleDocumentBoxEventArgs.Create(1558, Params);
OleDocumentBox1.OnOleDocumentEvent(OleDocumentBox1, Arg);
End Sub Button1OnClick;
After executing the example, clicking the button generates the event that occurs when the cursor is focused on the A1 cell for the Microsoft Excel sheet. This event can be handled in the OnOleDocumentEvent event of the OleDocumentBox component.
See also: