Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - How to enable menu item on popup?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to enable menu item on popup?

 Post Reply Post Reply
Author
Message
jeffcmj View Drop Down
Groupie
Groupie


Joined: 28 October 2004
Status: Offline
Points: 92
Post Options Post Options   Thanks (0) Thanks(0)   Quote jeffcmj Quote  Post ReplyReply Direct Link To This Post Topic: How to enable menu item on popup?
    Posted: 15 October 2005 at 7:40am

Hi, I use the following code to show a popup menu

int nID = CXTPCommandBars::TrackPopupMenu(&menu, TPM_RIGHTBUTTON|TPM_RECURSE|TPM_RETURNCMD, pt.x, pt.y, AfxGetMainWnd(),NULL,NULL,pBars);

My question is the menu items are all disabled, since I don't have a command handler. With MFC I can disable CMainFrame::m_bAutoMenuEnable to have them enabled, but with XTP, it does not work.

Please advise.

Thanks

Jeff

Back to Top
jeffcmj View Drop Down
Groupie
Groupie


Joined: 28 October 2004
Status: Offline
Points: 92
Post Options Post Options   Thanks (0) Thanks(0)   Quote jeffcmj Quote  Post ReplyReply Direct Link To This Post Posted: 16 October 2005 at 8:53am
I solve it myself by adding TPM_NONOTIFY flag.
Back to Top
umcbrad View Drop Down
Newbie
Newbie


Joined: 26 April 2005
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote umcbrad Quote  Post ReplyReply Direct Link To This Post Posted: 19 December 2005 at 9:36am

I would like some help with this problem also....menus is always grayed out...I can't seem to fix it...

As usual, it seems to work in the examples, but I can't see why...

I am trying to invoke it is the view of an MDI app.  Here is my code

void CVanGoghView::OnRButtonDown(UINT nFlags, CPoint point)
{
 // TODO: Add your message handler code here and/or call default
 
 CScrollView::OnRButtonDown(nFlags, point);

 ClientToScreen(&point);
 CMenu mnu;
 mnu.LoadMenu(IDR_RCLICK_OBJECT);
 //owner window is set to 'this', which means it gets the WM_COMMAND messages...
 CXTPCommandBars::TrackPopupMenu(&mnu, TPM_RIGHTBUTTON , point.x, point.y, this, 0, 0, gpTheVGMainFrm->GetCommandBars());
}

 

thanks,

 

Brad

Back to Top
umcbrad View Drop Down
Newbie
Newbie


Joined: 26 April 2005
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote umcbrad Quote  Post ReplyReply Direct Link To This Post Posted: 19 December 2005 at 9:40am

I also tried this, and it doesn't work...

CMenu mnu;
 mnu.LoadMenu(IDR_RCLICK_OBJECT);
 mnu.EnableMenuItem(ID_OBJECT_LINK_LABEL, TRUE);
 //owner window is set to 'this', which means it gets the WM_COMMAND messages...
 CXTPCommandBars::TrackPopupMenu(&mnu, TPM_RIGHTBUTTON , point.x, point.y, this, 0, 0, gpTheVGMainFrm->GetCommandBars());

Back to Top
jeffcmj View Drop Down
Groupie
Groupie


Joined: 28 October 2004
Status: Offline
Points: 92
Post Options Post Options   Thanks (0) Thanks(0)   Quote jeffcmj Quote  Post ReplyReply Direct Link To This Post Posted: 19 December 2005 at 10:56am
You shall have a command handler for the grayed command.
Back to Top
umcbrad View Drop Down
Newbie
Newbie


Joined: 26 April 2005
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote umcbrad Quote  Post ReplyReply Direct Link To This Post Posted: 19 December 2005 at 10:56am
ah, yes...I was overlooking that...thanks for the help!
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.