How can I enable Copy/Paste to work with CGXBrowserGrid, CGXDaoGrid and CGXRevordView? (OG full version only)
New for Objective Grid 6.1:
We added a BOOL variable to CGXBrowseParam. Simply set CGXBrowseParam::m_bAllowPasteMultiCells TRUE if you want to allow the user to paste multiple lines of text into the grid. If m_bAllowPasteMultiCells is FALSE the grid will only paste into the current cell (default). The default value is FALSE.
Objective Grid 6.0 and earlier versions:
The default implementation of the Paste() method in CGXBrowserGrid only support pasting one cell.
You can enable this functionality by overriding this method and calling the CGXGridCore version. The key point is not to call CGXBrowserGrid::Paste() and to limit clipboard support to CF_TEXT.
Example:
BOOL CMyBrowserGrid::Paste()
{
CGXBrowseParam* pBrowseData = GetBrowseParam();
if (!CanUpdate())
return FALSE;
// make sure that there is no range selected
if (GetParam() && GetParam()->GetRangeList()->GetCount() > 0)
return FALSE;
// check current cell
ROWCOL nRow, nCol;
if (!GetCurrentCell(nRow, nCol))
return FALSE;
// limit clipboard support to CF_TEXT
m_nClipboardFlags = GX_DNDTEXT;
BOOL bSuccess = CGXGridCore::Paste();
if (pBrowseData->m_nEditMode == noMode)
Update();
SetCurrentCell(nRow, nCol);
return bSuccess;
}
BOOL CMyBrowserGrid::CanPaste()
{
// don't call CGXBrowserGrid
return CGXGridCore::CanPaste();
}