Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » How can I get notification in-place cell edit is done? Collapse All
Subject Author Date
Thomas Roeder Nov 25, 2005 - 8:24 AM

Hello,


I’m using CExtGridWnd in my dialog.


I have to apply some logic after user has finished edit the cell.


Is there some way to get a notification message in my dialog box window procedure?


Or there is another way to handle this?


I’ll appreciate some example of sourcecode.


Thanks.


 

Thomas Roeder Nov 25, 2005 - 3:01 PM

Hi,


Thanks for the prompt responce.


The first method works just fine for me.


 

Technical Support Nov 25, 2005 - 11:36 AM

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 )
{
    .....
    .....
    .....
}

}