Built-in Cell Editors in 10Tec ActiveX Grid
The built-in editing system of iGrid is one of the greatest enhancements if we compare this grid control to the standard VB grid controls like MSFlexGrid/DataGrid or original vbAccelerator SGrid control. It includes the cell editors and unified set of events related to edit process.
Built-in cell editors (textbox, combobox and checkbox)
iGrid allows you to use the following built-in cell editors:
All these editors fully support the events described below which allow you to control the editing process.
Unified events for total control over editing
10Tec ActiveX grid implements its own set of events to control editing. Among them are the following events with self-descriptive names: RequestEdit
, BeforeCommitEdit
, AfterCommitEdit
and CancelEdit
. The following figure illustrates how these events work together:
Below you'll find a short description of the parameters of these events. The lRow
and lCol
parameters are common for these events and specify the edited cell.
Event | Parameters |
RequestEdit( _ ByVal lRow As Long, _ByVal lCol As Long, _ByVal lCharCode As Long, _ByRef bCancel As Boolean, _ByRef sText As String, _ByRef lMaxLength As Long, _ByRef eTextEditOpt As _ETextEditFlags) |
lCharCode - the Unicode code of the character entered by the user or zero for a mouse double-click;bCancel - allows to cancel editing;sText - the text to edit;lMaxLength - the maximum number of characters for textbox editing;eTextEditOpt - text editing options (convert all characters to uppercase, allow only numbers) |
BeforeCommitEdit( _ ByVal lRow As Long, _ByVal lCol As Long, _ByRef eResult As EEditResults, _ByVal sNewText As String, _ByRef vNewValue As Variant, _ByVal lConvErr As Long, _ByVal bCanProceedEditing As _Boolean, _ ByVal lComboListIndex As Long) |
eResult - specifies whether to apply changes, cancel changes or proceed with editing;sNewText - the text representation of the new cell value;vNewValue - you can change the value stored in the cell if the cell text doesn't coincide with the cell value;lConvErr - a conversion error code if the entered text cannot be converted to the type of the cell value;bCanProceedEditing - indicates whether we can proceed with editing;lComboListIndex - the index of the selected combo item for combo box cells |
AfterCommitEdit( _ ByVal lRow As Long, _ByVal lCol As Long, _ByVal vOldValue As Variant) |
vOldValue - the previous value of the edited cell |
CancelEdit( _ ByVal lRow As Long, _ByVal lCol As Long) |
Specific events to control text editing
You can also use specific events for the textbox editing feature - TextEditChange
, TextEditKeyPress
, TextEditKeyDown
and TextEditKeyUp
. These events work like the respective events of the standard Visual Basic TextBox control and allow sophisticated tuning of textbox editing to be set up.