Create(DispId: Integer; Params: Array);
DispId - identifier of the event that should be generated for the object loaded in OleDocumentBox.
Params - collection of parameters of the event that should 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 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 handled in the OnOleDocumentEvent event of the OleDocumentBox component.
See also: