event CellStateChanging (Item as HITEM, ColIndex as Long, NewState as Long)
Fired before cell's state is about to be changed.

 TypeDescription 
   Item as HITEM A long expression that indicates the handle of the item where the cell's state is about to be changed.   
   ColIndex as Long A long expression that indicates the index of the column where the cell's state is changed, or a long  expression that indicates the handle of the cell, if the Item parameter is 0.  
   NewState as Long A long expression that specifies the new state of the cell ( 0- unchecked, 1 - checked, 2 - partial checked )  

The control fires the CellStateChanging event just before cell's state is about to be changed. For instance, you can prevent changing the cell's state, by calling the NewState = Items.CellState(Item,ColIndex). A cell that contains a radio button or a check box button fires the CellStateChanged event when its state is changed. Use the CellState property to change the cell's state. Use the CellHasRadioButton or CellHasCheckBox property to enable radio or check box button into a cell. Use the Def property to assign check-boxes / radio-buttons for all cells in the column. Use the CellImage property to display an icon in the cell. Use the CellImages property to display multiple icons in the same cell.  Use the PartialCheck property to enable partial check feature ( check boxes with three states: partial, checked and unchecked ). Use the CellChecked property to determine the handle of the cell that's checked in a radio group. Use the CellRadioGroup property to radio group cells. We would not recommend changing the CellState property during the CellStateChanging event, to prevent recursive calls, instead you can change the NewState parameter which is passed by reference. 

Once the user clicks a check-box, radio-button, the control fires the following events:

For instance, the following VB sample prevents changing the cell's checkbox/radio-button, when the control's ReadOnly property is set:
Private Sub G2antt1_CellStateChanging(ByVal Item As EXG2ANTTLibCtl.HITEM, ByVal ColIndex As Long, NewState As Long)
    With G2antt1
        If (.ReadOnly) Then
            With .Items
                NewState = .CellState(Item, ColIndex)
            End With
        End If
    End With
End Sub

Syntax for CellStateChanging event, /NET version, on:

private void CellStateChanging(object sender,int   Item,int   ColIndex,ref int   NewState)
{
}

Private Sub CellStateChanging(ByVal sender As System.Object,ByVal Item As Integer,ByVal ColIndex As Integer,ByRef NewState As Integer) Handles CellStateChanging
End Sub

Syntax for CellStateChanging event, /COM version, on:

private void CellStateChanging(object sender, AxEXG2ANTTLib._IG2anttEvents_CellStateChangingEvent e)
{
}

void OnCellStateChanging(long   Item,long   ColIndex,long FAR*   NewState)
{
}

void __fastcall CellStateChanging(TObject *Sender,Exg2anttlib_tlb::HITEM   Item,long   ColIndex,long *   NewState)
{
}

procedure CellStateChanging(ASender: TObject; Item : HITEM;ColIndex : Integer;var NewState : Integer);
begin
end;

procedure CellStateChanging(sender: System.Object; e: AxEXG2ANTTLib._IG2anttEvents_CellStateChangingEvent);
begin
end;

begin event CellStateChanging(long  Item,long  ColIndex,long  NewState)

end event CellStateChanging

Private Sub CellStateChanging(ByVal sender As System.Object, ByVal e As AxEXG2ANTTLib._IG2anttEvents_CellStateChangingEvent) Handles CellStateChanging
End Sub

Private Sub CellStateChanging(ByVal Item As EXG2ANTTLibCtl.HITEM,ByVal ColIndex As Long,NewState As Long)
End Sub

Private Sub CellStateChanging(ByVal Item As Long,ByVal ColIndex As Long,NewState As Long)
End Sub

LPARAMETERS Item,ColIndex,NewState

PROCEDURE OnCellStateChanging(oG2antt,Item,ColIndex,NewState)

RETURN

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

<SCRIPT EVENT="CellStateChanging(Item,ColIndex,NewState)" LANGUAGE="JScript">
</SCRIPT>

<SCRIPT LANGUAGE="VBScript">
Function CellStateChanging(Item,ColIndex,NewState)
End Function
</SCRIPT>

Procedure OnComCellStateChanging HITEM   llItem Integer   llColIndex Integer   llNewState
	Forward Send OnComCellStateChanging llItem llColIndex llNewState
End_Procedure

METHOD OCX_CellStateChanging(Item,ColIndex,NewState) CLASS MainDialog
RETURN NIL

void onEvent_CellStateChanging(int   _Item,int   _ColIndex,COMVariant /*long*/   _NewState)
{
}

function CellStateChanging as v (Item  as  OLE::Exontrol.G2antt.1::HITEM,ColIndex  as  N,NewState  as  N)
end function

function nativeObject_CellStateChanging(Item,ColIndex,NewState)
return


Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.