Gets selected cell's screen-coordinates position and row/column index.
Gets selected cell's row/column index.
bool GetSelCell( int & nx, int & ny, int & nRow, int & nCol )
bool GetSelCell( int * pnRow, int * pnCol )
false if no selected cell, otherwise true
false if no selected cell, otherwise true
This section describes how to use ctrl+C and ctrl+V to copy/paste the selected cell's value.
Example codes can be added to GridControl's examples to run
ON_GRID_KEY(IDC_GRID, OnKeyDown) //add to class GridCtrlDLG's Message Map //add in class GridCtrlDLG BOOL OnKeyDown(Control ctrl, UINT msg, UINT wParam, UINT lParam) { if( WM_KEYDOWN != msg ) return FALSE; int nRow, nCol; m_GridCtrl.GetSelCell(&nRow, &nCol); switch( wParam ) { case 'c': case 'C': if( CNTRL_DOWN ) copy_to_clipboard(m_GridCtrl.GetCell(nRow, nCol), true, false); break; case 'v': case 'V': if( CNTRL_DOWN ) { string strVal; if( GetClipboardText(strVal) ) m_GridCtrl.SetCell(nRow, nCol, strVal); } break; } return TRUE; }
GridControl.h