You need to declare a CExGridWnd
-derived class and override the CExtGridWnd::OnGridCellInputComplete()
virtual method in it. It is called when in-place editing is complete and the cell value has been changed.
virtual void OnGridCellInputComplete(
CExtGridCell & _cell,
LONG nColNo,
LONG nRowNo,
INT nColType,
INT nRowType,
HWND hWndInputControl = NULL
);
void CMyGridWnd::OnGridCellInputComplete(
CExtGridCell & _cell,
LONG nColNo,
LONG nRowNo,
INT nColType,
INT nRowType,
HWND hWndInputControl // = NULL
)
{
ASSERT_VALID( this );
ASSERT_VALID( (&_cell) );
.....
.....
.....
}
You can also use derived cell classes with the overridden
CExtGridCell::OnInplaceControlTextInputComplete()
virtual method, which is also called when in-place editing is complete.
virtual void OnInplaceControlTextInputComplete(
HWND hWndInplaceControl,
CExtGridWnd & wndGrid,
LONG nVisibleColNo,
LONG nVisibleRowNo,
LONG nColNo,
LONG nRowNo,
INT nColType,
INT nRowType,
__EXT_MFC_SAFE_LPCTSTR sTextNew,
bool bSaveChanges
);
void CExtGridCell::OnInplaceControlTextInputComplete(
HWND hWndInplaceControl,
CExtGridWnd & wndGrid,
LONG nVisibleColNo,
LONG nVisibleRowNo,
LONG nColNo,
LONG nRowNo,
INT nColType,
INT nRowType,
__EXT_MFC_SAFE_LPCTSTR sTextNew,
bool bSaveChanges
)
{
ASSERT_VALID( this );
ASSERT( hWndInplaceControl != NULL && ::IsWindow(hWndInplaceControl) );
ASSERT_VALID( (&wndGrid) );
hWndInplaceControl;
wndGrid;
nVisibleColNo;
nVisibleRowNo;
nColNo;
nRowNo;
nColType;
nRowType;
sTextNew;
if( bSaveChanges )
{
TextSet( sTextNew );
CExtGridDataProvider & _DataProvider = wndGrid.OnGridQueryDataProvider();
_DataProvider.SortOrderUpdate( true, &wndGrid );
_DataProvider.SortOrderUpdate( false, &wndGrid );
CPoint ptFocus = wndGrid.FocusGet();
if( ptFocus.x >= 0 )
wndGrid.EnsureVisibleColumn( ptFocus.x );
if( ptFocus.y >= 0 )
wndGrid.EnsureVisibleRow( ptFocus.y );
}
wndGrid.OnGridCellInplaceControlTextInputComplete(
*this,
hWndInplaceControl,
nVisibleColNo,
nVisibleRowNo,
nColNo,
nRowNo,
nColType,
nRowType,
sTextNew,
bSaveChanges
);
if( bSaveChanges )
{
.....
.....
.....
}
}