property G2antt.Editing as Long
Specifies the window's handle of the built-in editor while the control is running in edit mode.

TypeDescription
Long A long expression that indicates the window's handle for the built-in editor that's focused while the control is running in the edit mode.

Use the Editing property to check whether the control is in edit mode.  Use the Editing property to get the window's handle for the built-in editor while editing.  Use the Edit method to start editing the focused cell. Use the EditType property to define the column's editor. Use the ReadOnly property to make the control read only. Call the EditClose method to close the current editor. The EditingText property returns the caption being shown on the editor while the control runs in edit mode. The Editing property returns a not-zero value only if called during the EditOpen, Change or EditClose event.

The edit events are fired in the following order:

  1. Edit event. Prevents editing cells, before showing the cell's editor.

  2. 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.

  3. 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.

  4. EditClose event. The cell's editor is hidden and closed.

The following VB sample closes the current editor if the user presses the enter key:

Private Sub G2antt1_KeyDown(KeyCode As Integer, Shift As Integer)
    With G2antt1
        If Not (.Editing = 0) Then
            If (KeyCode = vbKeyReturn) Then
                .EditClose
                KeyCode = 0
            End If
        End If
    End With
End Sub

The following C++ sample closes the editor when user hits the enter key:

void OnKeyDownG2antt1(short FAR* KeyCode, short Shift) 
{
	if ( *KeyCode == VK_RETURN )
		if ( m_g2antt.GetEditing() != 0 )
		{
			m_g2antt.EditClose();
			*KeyCode = 0;
		}
}

The following C# sample closes the editor when user hits the enter key:

private void axG2antt1_KeyDownEvent(object sender, AxEXG2ANTTLib._IG2anttEvents_KeyDownEvent e)
{
	if (Convert.ToUInt32(e.keyCode) == Convert.ToUInt32(Keys.Enter))
		if (axG2antt1.Editing != 0)
		{
			axG2antt1.EditClose();
			e.keyCode = 0;
		}
}

The following VB.NET sample closes the editor when user hits the enter key:

Private Sub AxG2antt1_KeyDownEvent(ByVal sender As Object, ByVal e As AxEXG2ANTTLib._IG2anttEvents_KeyDownEvent) Handles AxG2antt1.KeyDownEvent
    If (Convert.ToUInt32(e.keyCode) = Convert.ToUInt32(Keys.Enter)) Then
        With AxG2antt1
            If Not (.Editing = 0) Then
                .EditClose()
                e.keyCode = 0
            End If
        End With
    End If
End Sub

The following VFP sample closes the editor when user hits the enter key:

*** ActiveX Control Event ***
LPARAMETERS keycode, shift

if ( keycode = 13 ) &&vkReturn
	with thisform.G2antt1.Object
		if ( .Editing() != 0 )
			.EditClose()
			keycode = 0
		endif
	endwith
endif

If your application still requires the string that user types into an text box inside the exG2antt control. you can use the following VB trick:

Private Sub G2antt1_Change(ByVal Item As EXG2ANTTLibCtl.HITEM, ByVal ColIndex As Long, NewValue As Variant)
    ' Finds the text inside the text box, in case that NewValue parameter is changed to a valid data
    Debug.Print getWndText(getEditWnd(G2antt1))
End Sub

Private Function getEditWnd(ByVal g As EXG2ANTTLibCtl.G2antt) As Long
    Dim h As Long
    h = GetWindow(g.hwnd, GW_CHILD)
    While Not (h = 0)
        If (getWndClass(h) = "HolderBuiltIn") Then
                getEditWnd = GetWindow(h, GW_CHILD)
            Exit Function
        End If
        h = GetWindow(h, GW_HWNDNEXT)
    Wend
    getEditWnd = 0
End Function

Private Function getWndText(ByVal h As Long) As String
    Dim s As String
    s = Space(1024)
    GetWindowText h, s, 1024
    getWndText = To0(s)
End Function

Private Function getWndClass(ByVal h As Long) As String
    Dim s As String
    s = Space(1024)
    GetClassName h, s, 1024
    getWndClass = To0(s)
End Function

Private Function To0(ByVal s As String) As String
    To0 = Left$(s, InStr(s, Chr$(0)) - 1)
End Function

The sample requires the following API declarations:

Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Private Const GW_CHILD = 5
Private Const GW_HWNDNEXT = 2

The following C++ sample displays a message box with the caption that user types inside the text box of an editor:

 

HWND getEditWnd( HWND h )
{
	TCHAR szName[1024] = _T("");
	h = GetWindow( h, GW_CHILD );
	while ( !( h == 0 ) )
	{
		GetClassName( h, szName, 1024 );
		if ( _tcscmp( _T("HolderBuiltIn"), szName ) == 0 )
			return GetWindow( h, GW_CHILD );
		h = GetWindow( h, GW_HWNDNEXT );
	}
	return 0;
}

void OnChangeG2antt1(long Item, long ColIndex, VARIANT FAR* NewValue) 
{
	HWND h = getEditWnd( m_g2antt.m_hWnd );
	if ( h )
	{
		TCHAR szText[1024] = _T("");
		::GetWindowText( h, szText, 1024 );
		::MessageBox( NULL, szText,NULL, NULL );
	}
}