BCGControlBar Pro for MFC
void CBCGPGridCtrl::EnableVirtualMode ( BCGPGRID_CALLBACK  pCallback = NULL,
LPARAM  lParam = 0 
)

Enables virtual mode.

Call this function to enable virtual mode. When the virtual mode has been enabled, you cannot disable it anymore. If you have no callback function, and pCallback is NULL, then the grid will send BCGPGN_GETDISPINFO (currently it's the same as LVN_GETDISPINFO) notification message to its owner. In that case you should handle this notification message, fill up and return TRUE.

The callback function has the following prototype:

BOOL CALLBACK CallbackFunc (BCGPGRID_DISPINFO*, LPARAM);

Parameters
pCallbackPoints to a callback function
lParamUsed to pass a user-defined value to the callback function.

Example 1:

Copy
static BOOL CALLBACK GridCallback (BCGPGRID_DISPINFO* pdi, LPARAM lp)
{
ASSERT (pdi != NULL);
CMyGridCtrl* pGridCtrl = (CMyGridCtrl *) lp;
int nRow = pdi->item.nRow; // Row of an item
int nCol = pdi->item.nCol; // Column of an item
CString str;
str.Format(_T("Callback %d, %d"), nRow, nCol);
pdi->item.varValue = (LPCTSTR) str;
return TRUE;
}
int CMyGridCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
//...
EnableVirtualMode(GridCallback, (LPARAM) this);
}

Example 2:

Copy
BOOL CGridView::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
ASSERT_VALID (this);
CBCGPGridCtrl* pGridCtrl = GetGridCtrl ();
ASSERT_VALID (pGridCtrl);
if (wParam == (WPARAM)pGridCtrl->GetDlgCtrlID())
{
*pResult = TRUE;
if (BCGPGRID_DISPINFO == pdi->hdr.code)
{
int nRow = pdi->item.nRow; // Row of an item
int nCol = pdi->item.nCol; // Column of an item
CString str;
str.Format(_T("Message %d, %d"), nRow, nCol);
pdi->item.varValue = _variant_t (str);
return TRUE;
}
}
return CView::OnNotify(wParam, lParam, pResult);
}
See also
CBCGPGridCtrl::SetVirtualRows