-
Context Menus
I have a dialog based application with support for the context menu when you right-click on the dialog.
At the moment it comes up with a cut/copy/paste menu. The problem is that this menu displays absolutely anywhere on the window, which is wrong.
I only want it to display if it is on the IDC_CONFIG_GRID control. I assume I have to use the passed Cwnd variable in some way.
I am desperate for someones help.
Please email me either on this address or:
[email protected]
Thanks for your help!
-
Re: Context Menus
sounds like you need to adding some mouse tracking. How about:
void CBlahDlg::OnContextMenu(CWnd* pWnd, CPoint point)
{
CMenu menu;
CMenu* pSubmenu;
menu.LoadMenu(IDR_MENU1);
pSubmenu = menu.GetSubMenu(0);
pSubmenu->TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON, point.x, point.y, AfxGetApp()->m_pMainWnd,NULL);
}
-
Re: Context Menus
Hi,
Thanks for the advice.
I found this works:
if(pWnd->GetDlgCtrlID() == IDC_CONFIG_GRID)
{
...
...
}