Built-in Cell Editors in 10Tec ActiveX Grid

(iGrid Control Tour, Step 4 of 6)

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:

Built-in editors (textbox, checkbox and combobox) for 10Tec ActiveX grid cells

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:

Events to control editing in iGrid ActiveX grid

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.

View iGrid code examples »