Type | Description | |||
Item as HITEM | A long expression that determines the item's handle. If the Item parameter is 0, and the ColIndex property is different than zero, the ColIndex indicates the handle of the cell where the state is changed. | |||
ColIndex as Long | A long expression that indicates the column's index, if the Item parameter is not zero, a long expression that indicates the handle of the cell if the Item parameter is 0. | |||
Cancel as Boolean | (By Reference) A boolean expression that indicates whether the editing operation is canceled. |
The Edit event is fired when the edit operation is about to begin. Use the Edit event to disable editing specific cells. The Edit event is not fired if the user changes programmatically the CellValue property. Use the EditOpen event to notify your application that editing the cell started. Use the EditClose event to notify your application that editing the cell ended. Use the Change event to notify your application that user changes the cell's value. Use the Edit method to edit a cell by code. Use the CellEditor or Editor property to assign an editor to a cell or to a column.
The edit events are fired in the following order:
Edit event. Prevents editing cells, before showing the cell's editor.
EditOpen event. The edit operation started, the cell's editor is shown. The Editing property gives the window's handle of the built-in editor being started.
Change event. The Change event is fired only if the user types ENTER key, or the user selects a new value from a predefined data list.
EditClose event. The cell's editor is hidden and closed.
private void EditEvent(object sender,int Item,int ColIndex,ref bool Cancel) { } Private Sub EditEvent(ByVal sender As System.Object,ByVal Item As Integer,ByVal ColIndex As Integer,ByRef Cancel As Boolean) Handles EditEvent End Sub |
private void EditEvent(object sender, AxEXGRIDLib._IGridEvents_EditEvent e) { } void OnEdit(long Item,long ColIndex,BOOL FAR* Cancel) { } void __fastcall Edit(TObject *Sender,Exgridlib_tlb::HITEM Item,long ColIndex,VARIANT_BOOL * Cancel) { } procedure Edit(ASender: TObject; Item : HITEM;ColIndex : Integer;var Cancel : WordBool); begin end; procedure EditEvent(sender: System.Object; e: AxEXGRIDLib._IGridEvents_EditEvent); begin end; begin event Edit(long Item,long ColIndex,boolean Cancel) end event Edit Private Sub EditEvent(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_EditEvent) Handles EditEvent End Sub Private Sub Edit(ByVal Item As EXGRIDLibCtl.HITEM,ByVal ColIndex As Long,Cancel As Boolean) End Sub Private Sub Edit(ByVal Item As Long,ByVal ColIndex As Long,Cancel As Boolean) End Sub LPARAMETERS Item,ColIndex,Cancel PROCEDURE OnEdit(oGrid,Item,ColIndex,Cancel) RETURN |
<SCRIPT EVENT="Edit(Item,ColIndex,Cancel)" LANGUAGE="JScript"> </SCRIPT> <SCRIPT LANGUAGE="VBScript"> Function Edit(Item,ColIndex,Cancel) End Function </SCRIPT> Procedure OnComEdit HITEM llItem Integer llColIndex Boolean llCancel Forward Send OnComEdit llItem llColIndex llCancel End_Procedure METHOD OCX_Edit(Item,ColIndex,Cancel) CLASS MainDialog RETURN NIL void onEvent_Edit(int _Item,int _ColIndex,COMVariant /*bool*/ _Cancel) { } function Edit as v (Item as OLE::Exontrol.Grid.1::HITEM,ColIndex as N,Cancel as L) end function function nativeObject_Edit(Item,ColIndex,Cancel) return |
The following VB sample disables editing cells in the first column:
Private Sub Grid1_Edit(ByVal Item As EXGRIDLibCtl.HITEM, ByVal ColIndex As Long, Cancel As Boolean) ' Cancels editing first column Cancel = IIf(ColIndex = 0, True, False) End Sub
The following VB sample changes the cell's value to a default value, if the user enters an empty value:
Private Sub Grid1_Edit(ByVal Item As EXGRIDLibCtl.HITEM, ByVal ColIndex As Long, Cancel As Boolean) ' Sets the 'default' value for empty cell With Grid1.Items If (Len(.CellValue(Item, ColIndex)) = 0) Then .CellValue(Item, ColIndex) = "default" End If End With End Sub
The following C++ sample disables editing cells in the first column:
void OnEditGrid1(long Item, long ColIndex, BOOL FAR* Cancel) { if ( ColIndex == 0 ) *Cancel = TRUE; }
The following VB.NET sample disables editing cells in the first column:
Private Sub AxGrid1_EditEvent(ByVal sender As Object, ByVal e As AxEXGRIDLib._IGridEvents_EditEvent) Handles AxGrid1.EditEvent If (e.colIndex = 0) Then e.cancel = True End If End Sub
The following C# sample disables editing cells in the first column:
private void axGrid1_EditEvent(object sender, AxEXGRIDLib._IGridEvents_EditEvent e) { if (e.colIndex == 0) e.cancel = true; }
The following VFP sample disables editing cells in the first column:
*** ActiveX Control Event *** LPARAMETERS item, colindex, cancel if ( colindex = 0 ) cancel = .t. endif