camuto
July 16th, 1999, 12:27 PM
Hey,
I am trying to get a pulldown menu to work with a mdi program. Problem is that the mouse never lines up
with the window. I have tried every **** coordinate system conversion to try to get the right location but it never works: I have a function something like this:
void C2dEditView::PopupMenu(CPoint pt)
{
if(::GetKeyState(VK_SHIFT) < 0)
{
CMenu menu;
VERIFY(menu.LoadMenu(IDR_PULLDOWN_MENU));
CMenu* pPopup = menu.GetSubMenu(0);
ASSERT(pPopup != NULL);
::MapWindowPoints((HWND )this,(HWND )::AfxGetMainWnd(),&pt,1);
pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, this);
}
}
where pt is the point from my OnRightDown... call back from the C@DeditView class which is derived from CView.
Any help on this basic topic would be great
I am trying to get a pulldown menu to work with a mdi program. Problem is that the mouse never lines up
with the window. I have tried every **** coordinate system conversion to try to get the right location but it never works: I have a function something like this:
void C2dEditView::PopupMenu(CPoint pt)
{
if(::GetKeyState(VK_SHIFT) < 0)
{
CMenu menu;
VERIFY(menu.LoadMenu(IDR_PULLDOWN_MENU));
CMenu* pPopup = menu.GetSubMenu(0);
ASSERT(pPopup != NULL);
::MapWindowPoints((HWND )this,(HWND )::AfxGetMainWnd(),&pt,1);
pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, this);
}
}
where pt is the point from my OnRightDown... call back from the C@DeditView class which is derived from CView.
Any help on this basic topic would be great