• Advertisement

Archived

This topic is now archived and is closed to further replies.

Popup Menu not popping up ;(

This topic is 6523 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, all. This is straight from the book. It compiles fine, but when I run it and click the RMB, no popup menu appears. What gives? CMenu * g_pmenuContext; CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { ... g_pmenuContext = new CMenu(); if (!g_pmenuContext) return -1; BOOL bSuccess = g_pmenuContext->LoadMenu(IDR_MENU1); if (!bSuccess) return -1; ... } void CMainFrame::OnRButtonDown(UINT nFlags, CPoint point) { ClientToScreen(&point); CMenu * psubmenu = g_pmenuContext->GetSubMenu(1); psubmenu->TrackPopupMenu(TPM_LEFTALIGN /TPM_RIGHTBUTTON, point.x, point.y, this); CFrameWnd::OnRButtonDown(nFlags, point); } Thanks

Share this post


Link to post
Share on other sites
Advertisement
Hi!

You need to handle the WM_CONTEXTMENU message.


void CMyView::OnContextMenu(CWnd* pWnd, CPoint point)
{
CMenu menu;
menu.LoadMenu(IDR_MYFLOATINGMENU);
menu.GetSubMenu(0)->TrackPopupMenu(.......);
}


*Sparkle*


Edited by - Sparkle on 4/12/00 5:24:44 AM

Share this post


Link to post
Share on other sites
Do I handle the WM_CONTEXTMENU message in addition to the WM_RBUTTONDOWN message or instead of it?

Share this post


Link to post
Share on other sites

  • Advertisement