![]() | Type | Description | ||
| Object as Object | An object created by UserEditor property. | |||
| 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. |
Use the UserEditorClose event to notify your application when the user editor is hidden. Use the UserEditorClose event to update the cell's value when user editor is hidden. The control fires UserEditorOleEvent event each time when a an user editor object fires an event.
The following VB sample updates the cell's value when the user editor is hidden ( the sample handles the event for an exMaskEdit inside ):
Private Sub Grid1_UserEditorClose(ByVal Object As Object, ByVal Item As EXGRIDLibCtl.HITEM, ByVal ColIndex As Long)
With Grid1.Items
.CellValue(Item, ColIndex) = Object.Text
End With
End SubThe following C++ sample updates the cell's value when the user editor is hidden ( the sample handles the event for an exMaskEdit inside ):
#import <maskedit.dll>
#include "Items.h"
void OnUserEditorCloseGrid1(LPDISPATCH Object, long Item, long ColIndex)
{
MaskEditLib::IMaskEditPtr spMaskEdit( Object );
if ( spMaskEdit != NULL )
{
COleVariant vtNewValue(spMaskEdit->GetText());
m_grid.GetItems().SetCellValue( COleVariant( Item ), COleVariant( ColIndex ), vtNewValue );
}
}where the #import <maskedit.dll> defines the type library of the exMaskEdit component, in the MaskEditLib namespace. The V2S function converts a VARIANT value to a string value and may look like follows:
static CString V2S( VARIANT* pv, LPCTSTR szDefault = _T("") )
{
if ( pv )
{
if ( pv->vt == VT_ERROR )
return szDefault;
COleVariant vt;
vt.ChangeType( VT_BSTR, pv );
return V_BSTR( &vt );
}
return szDefault;
}The following VB.NET sample updates the cell's value when the user editor is hidden ( the sample handles the event for an exMaskEdit inside ):
Private Sub AxGrid1_UserEditorClose(ByVal sender As Object, ByVal e As AxEXGRIDLib._IGridEvents_UserEditorCloseEvent) Handles AxGrid1.UserEditorClose
With AxGrid1.Items
.CellValue(e.item, e.colIndex) = e.object.Text
End With
End SubThe following C# sample updates the cell's value when the user editor is hidden ( the sample handles the event for an exMaskEdit inside ):
private void axGrid1_UserEditorClose(object sender, AxEXGRIDLib._IGridEvents_UserEditorCloseEvent e)
{
MaskEditLib.MaskEdit maskEdit = e.@object as MaskEditLib.MaskEdit;
if (maskEdit != null)
axGrid1.Items.set_CellValue(e.item, e.colIndex, maskEdit.Text);
}where the MaskEditLib class is defined by adding a new reference to the ExMaskEdit component to your project.
The following VFP sample updates the cell's value when the user editor is hidden ( the sample handles the event for an exMaskEdit inside ):
*** ActiveX Control Event *** LPARAMETERS object, item, colindex with thisform.Grid1.Items .DefaultItem = item .CellValue( 0, colindex ) = object.Text() endwith