Param(Index: Integer): Variant;
Index is an index of the parameter of event of the object loaded in the OleDocumentBox.
The Param property returns parameter of event of the object loaded in the OleDocumentBox.
Methods of the Variant class are used to work with parameters. Learn the appropriate class of object using third-party applications to get information about parameters of the particular event.
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 OleDocumentBox1OnOleDocumentEvent(Sender: IOleDocumentBox; Args: IOleDocumentBoxEventArgs);
Var
Sheet, Range: Variant;
Row, Column: Integer;
s: String;
Begin
If Args.DispId = 1559 Then
Sheet := Args.Params.Param(0);
s := Sheet.GetProperty("Name") As String;
Range := Args.Params.Param(1);
Column := Range.GetProperty("Column") As Integer;
Row := Range.GetProperty("Row") As Integer;
Args.Params.Param(2) := True;
End If;
End Sub OleDocumentBox1OnOleDocumentEvent;
The double click of the main button on the sheet cell is fixed during execution of the OnOleDocumentEvent event. This event has identifier - 1559, three parameters are passed in it: 1) The sheet on which the event is generated; 2) The cell on which double click was made. This parameter is a range and contains a lot of parameters. The GetProperty method is used for its analysis; 3) The logic parameter that determines whether the cell edit mode should be enabled. The "s" variable contains the name of the sheet, the Row and Column variables contains a number of row and a number of column, respectively, on which there was a mouse double click, and it is prohibited to activate edit mode.
See also: