Create(DispId: Integer; Params: Array);
DispId is an identifier of the event that should be generated for the object loaded in the OleDocumentBox.
Params is a collection of parameters of the event that should be generated for the object loaded in the OleDocumentBox.
The Create designer creates argument that describes an event that should be generated for the object loaded in the OleDocumentBox.
Executing the example requires a form, a button named Button1 on it and the OleDocumentBox component. The Microsoft Excel sheet was loaded in 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 pressing 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 processed in the OnOleDocumentEvent event of the OleDocumentBox component.
See also: