How can I display a dialog or popup-menu when the user clicked the right mouse button? (June, 13)
You should override the OnRButtonClickedRowCol() method and call TrackPopupMenu.
Example:
BOOL CMyGridCtrl::OnRButtonClickedRowCol(ROWCOL nRow, ROWCOL nCol, UINT nFlags, CPoint pt)
{
// unreferenced parameters
nRow, nCol, nFlags;
CMenu menu;
VERIFY(menu.LoadMenu(IDR_POPUP_GRID_CONTROL));
CMenu* pPopup = menu.GetSubMenu( 0 );
ASSERT( pPopup != NULL );
CWnd* pWndPopupOwner = AfxGetMainWnd( );
// display the menu
ClientToScreen(&pt);
pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
pt.x, pt.y, pWndPopupOwner);
// we processed the message
return TRUE;
}