|
-
March 29th, 1999, 11:03 AM
#1
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!
-
March 29th, 1999, 11:15 AM
#2
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);
}
-
March 29th, 1999, 02:15 PM
#3
Re: Context Menus
Hi,
Thanks for the advice.
I found this works:
if(pWnd->GetDlgCtrlID() == IDC_CONFIG_GRID)
{
...
...
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|