Solved

Graying Popup Menu Items

Posted on 1997-11-03
7
365 Views
Last Modified: 2013-11-20
I have had success had graying out menu items in the OnUpdatMenuName(CCmdUI *pCmdUI) functions using

     pCmdUI->Enable(some BOOL);

how do I extend that to my pop up menus?  Thanks!
0
Comment
Question by:mitchell042997
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 2

Expert Comment

by:wpinto
ID: 1309243
There's no difference between normal menus & pop up menus with respect to graying out menu items. Try out the same technique & it should work fine with pop up menus

Hope this helps

Wilfred
0
 
LVL 2

Expert Comment

by:wpinto
ID: 1309244
Hey mitchell,

You haven't accepted/rejected my previous answer to your question 'VC++ Menu question' under C++!

I would really appreciate if you could do the needful

Thanks,
Wilfred
0
 
LVL 2

Author Comment

by:mitchell042997
ID: 1309245
I appologize.  I find your answer ineffective.  I have in my CDocument the mapped OnUpdatexxxUI already in place, yet it does not work for the popup menus.  Is there an additional function I need to use for popups?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:wpinto
ID: 1309246
Hi mitchell,

There is no additional function that you need to use apart from the OnUpdatexxx handler.

I have used it successfully.

Try out the following:
You said that you can enable/disable a menuitem. Choose any popup menu item & give it the same id as one of the menuitems which you can disable. Please note that the id should be the same. Now check to see if both the menuitems (ie. the original menuitem & the popup menuitem) are disabled.

If the original menuitem is disabled, the popup menuitem should also get disabled since they have the same ID.

Hope this helps

Wilfred

PS. You still haven't accepted/rejected my answer to the question 'VC++ Menu question' under C++. Its already over 2 weeks old. Since you have stated in this question that you can gray menuitems, I suppose that you are in a position to grade my previous answer.
0
 
LVL 2

Expert Comment

by:wpinto
ID: 1309247
Hi mitchell,

Did the above technique work?

Please let me know so that I can post it as an answer

Wilfred
0
 

Accepted Solution

by:
Vance Kessler earned 50 total points
ID: 1309248
I had similar problems.  I found that if I made the owning frame window be the target of the TrackPopupMenu() call, that the built in menu updating features of MFC did work properly.  Here is an example of how to call TrackPopupMenu to have this work:

void CMyWin::OnContextMenu(CWnd* pWnd, CPoint point)
{
   CMenu menu;
   if (!menu.LoadMenu(IDR_SOME_MENU) ) return;
   CMenu* mPtr = menu.GetSubMenu(0);
   if (NULL != mPtr) {
      mPtr->TrackPopupMenu(TPM_LEFTALIGN, point.x, point.y,
            GetParentFrame() );
   }
}

0
 
LVL 2

Author Comment

by:mitchell042997
ID: 1309249
Thanks for the info, Vance
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Get filename and folder into excel 7 89
wait notify demo infinite loop 3 151
Problem to event 3 123
JQuery serialize and unserialize 8 274
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question