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:

Method Parameters
RequestEdit( _
   ByVal lRow As Long, _
   ByVal lCol As Long, _
   ByVal iKeyAscii As Integer, _
   ByRef bCancel As Boolean, _
   ByRef sText As String, _
   ByRef lMaxLength As Long)
iKeyAscii - returns the ASCII code of the key that has just been pressed (or zero for a mouse double-click);
bCancel - used to protect a cell from editing;
lMaxLength - the maximum number of characters for textbox editing
BeforeCommitEdit( _
   ByVal lRow As Long, _
   ByVal lCol As Long, _
   ByRef eResult As EEditResults, _
   ByVal sNewText As String, _
   ByRef vNewValue As Variant)
eResult - igEditResCommit (apply changes), igEditResCancel (cancel changes) or igEditResProceed (don't finish editing);
vNewValue - you can change the value stored in the cell if the cell text doesn't coincide with the cell value
AfterCommitEdit( _
   ByVal lRow As Long, _
   ByVal lCol As Long)
The lRow and lCol parameters in all these events specify 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 »