event BeforeCellEdit (Item as HITEM, ColIndex as Long, ByRef Value as Variant, ByRef Cancel as Variant)

Occurs just before the user enters edit mode by clicking twice in a cell.

TypeDescription
Item as HITEM A long expression that indicates the handle of the item being changed.
ColIndex as Long A long expression that specifies the index of the column where the change occurs, or the handle of the cell being edited if the Item parameter is 0.
Value as Variant (By Reference) A Variant expression that indicates the edit's caption. By default, the caption of the edit control is the cell's caption. The user can change the text that the edit control displays.
Cancel as Variant (By Reference) A boolean expression that indicates whether the control cancels the default operation.

The BeforeCellEdit event notifies your application that the user starts editing a cell. Use the Edit method to programmatically edits a cell. Use the AllowEdit property to enable edit feature in the tree control.  Use the BeforeCellEdit event to cancel editing cells or to change the edit's caption before it is displayed. Use the AfterCellEdit to change the cell's caption when the edit operation ends. The CancelCellEdit event occurs if the user cancels the edit operation. The CancelCellEdit event is fired when the user presses ESC key while editing or when the user clicks outside the edit field.

Syntax for BeforeCellEdit event, /NET version, on:

private void BeforeCellEdit(object sender,int Item,int ColIndex,ref object Value,ref object Cancel)
{
}

Private Sub BeforeCellEdit(ByVal sender As System.Object,ByVal Item As Integer,ByVal ColIndex As Integer,ByRef Value As Object,ByRef Cancel As Object) Handles BeforeCellEdit
End Sub

Syntax for BeforeCellEdit event, /COM version, on:

private void BeforeCellEdit(object sender, AxEXTREELib._ITreeEvents_BeforeCellEditEvent e)
{
}

void OnBeforeCellEdit(long Item,long ColIndex,VARIANT FAR* Value,VARIANT FAR* Cancel)
{
}

void __fastcall BeforeCellEdit(TObject *Sender,Extreelib_tlb::HITEM Item,long ColIndex,Variant * Value,Variant * Cancel)
{
}

procedure BeforeCellEdit(ASender: TObject; Item : HITEM;ColIndex : Integer;var Value : OleVariant;var Cancel : OleVariant);
begin
end;

procedure BeforeCellEdit(sender: System.Object; e: AxEXTREELib._ITreeEvents_BeforeCellEditEvent);
begin
end;

begin event BeforeCellEdit(long Item,long ColIndex,any Value,any Cancel)
end event BeforeCellEdit

Private Sub BeforeCellEdit(ByVal sender As System.Object, ByVal e As AxEXTREELib._ITreeEvents_BeforeCellEditEvent) Handles BeforeCellEdit
End Sub

Private Sub BeforeCellEdit(ByVal Item As EXTREELibCtl.HITEM,ByVal ColIndex As Long,Value As Variant,Cancel As Variant)
End Sub

Private Sub BeforeCellEdit(ByVal Item As Long,ByVal ColIndex As Long,Value As Variant,Cancel As Variant)
End Sub

LPARAMETERS Item,ColIndex,Value,Cancel

PROCEDURE OnBeforeCellEdit(oTree,Item,ColIndex,Value,Cancel)
RETURN

Syntax for BeforeCellEdit event, /COM version (others), on:

<SCRIPT EVENT="BeforeCellEdit(Item,ColIndex,Value,Cancel)" LANGUAGE="JScript">
</SCRIPT>

<SCRIPT LANGUAGE="VBScript">
Function BeforeCellEdit(Item,ColIndex,Value,Cancel)
End Function
</SCRIPT>

Procedure OnComBeforeCellEdit HITEM llItem Integer llColIndex Variant llValue Variant llCancel
	Forward Send OnComBeforeCellEdit llItem llColIndex llValue llCancel
End_Procedure

METHOD OCX_BeforeCellEdit(Item,ColIndex,Value,Cancel) CLASS MainDialog
RETURN NIL

void onEvent_BeforeCellEdit(int _Item,int _ColIndex,COMVariant /*variant*/ _Value,COMVariant /*variant*/ _Cancel)
{
}

function BeforeCellEdit as v (Item as OLE::Exontrol.Tree.1::HITEM,ColIndex as N,Value as A,Cancel as A)
end function

function nativeObject_BeforeCellEdit(Item,ColIndex,Value,Cancel)
return

The following VB sample cancels editing of any cell that belongs to the first column:

Private Sub Tree1_BeforeCellEdit(ByVal Item As EXTREELibCtl.HITEM, ByVal ColIndex As Long, Value As Variant, Cancel As Variant)
    Cancel = ColIndex = 0
End Sub

The following VB.NET sample cancels editing of any cell that belongs to the first column:

Private Sub AxTree1_BeforeCellEdit(ByVal sender As Object, ByVal e As AxEXTREELib._ITreeEvents_BeforeCellEditEvent) Handles AxTree1.BeforeCellEdit
        e.cancel = e.colIndex = 0
End Sub

The following C# sample cancels editing of any cell that belongs to the first column:

private void axTree1_BeforeCellEdit(object sender, AxEXTREELib._ITreeEvents_BeforeCellEditEvent e)
{
	e.cancel = e.colIndex == 0;
}

The following C++ sample cancels editing of any cell that belongs to the first column:

void OnBeforeCellEditTree1(long Item, long ColIndex, VARIANT FAR* Value, VARIANT FAR* Cancel) 
{
	if ( ColIndex == 0 )
	{
		V_VT( Cancel ) = VT_BOOL;
		V_BOOL( Cancel ) = VARIANT_TRUE;
	}
}

The following VFP sample cancels editing of any cell that belongs to the first column:

*** ActiveX Control Event ***
LPARAMETERS item, colindex, value, cancel

if ( colindex = 0 ) 
	cancel = .t.
endif