event EditClose ()
Occurs when the edit operation ends.

 TypeDescription 
Use the EditClose event to notify your application that the editor is closed. The EditClose event is fired when the focused cell ends editing. Use the FocusItem property to determine the handle of the item where the edit operation ends. Use the FocusColumnIndex property to determine the index of the column where the edit operation ends. The Editing specifies the window's handle of the built-in editor while the control is running in edit mode. Use the EditClose method to closes the current editor, by code.  For instance, the EditClose event is not fired when user hides the drop down portion of the editor. Use the Edit event to prevent editing a cell.

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 displays the window's handle of the built-in editor being closed:

Private Sub Grid1_EditClose()
    Debug.Print "EditClose " & Grid1.Editing
End Sub

The following VB sample displays the caption of the cell where the edit operation ends:

Private Sub Grid1_EditClose()
    With Grid1.Items
        Debug.Print "EditClose on '"; .CellCaption(.FocusItem, Grid1.FocusColumnIndex) & "'."
    End With
End Sub

The following C++ sample displays the handle of the built-in editor being closed:

#include "Items.h"
void OnEditCloseGrid1() 
{
	CItems items = m_grid.GetItems();
	COleVariant vtItem( items.GetFocusItem() ), vtColumn( m_grid.GetFocusColumnIndex() );
	CString strFormat;
	strFormat.Format( "'%s'  %i", V2S( &items.GetCellValue( vtItem, vtColumn ) ), m_grid.GetEditing() );
	OutputDebugString( strFormat );
}

The following VB.NET sample displays the handle of the built-in editor being closed:

Private Sub AxGrid1_EditCloseEvent(ByVal sender As Object, ByVal e As System.EventArgs) Handles AxGrid1.EditCloseEvent
    With AxGrid1
        Debug.Print(.Items.CellValue(.Items.FocusItem, .FocusColumnIndex) & " " & .Editing.ToString())
    End With
End Sub

The following C# sample displays the handle of the built-in editor being closed:

private void axGrid1_EditCloseEvent(object sender, EventArgs e)
{
	object cellValue = axGrid1.Items.get_CellValue(axGrid1.Items.FocusItem, axGrid1.FocusColumnIndex);
	string strOutput = "'" + (cellValue != null ? cellValue.ToString() : "") + "' " + axGrid1.Editing.ToString();
	System.Diagnostics.Debug.WriteLine( strOutput );
}

The following VFP sample displays the handle of the built-in editor being closed:

*** ActiveX Control Event ***

with thisform.Grid1.Items
	.DefaultItem = .FocusItem()
	wait window nowait str(.CellValue( 0, thisform.Grid1.FocusColumnIndex() ))
	wait window nowait str(thisform.Grid1.Editing())
endwith

 


Send comments on this topic.
© 1999-2008 Exontrol Inc, Software. All rights reserved.