Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Graying Popup Menu Items

Posted on 1997-11-03
7
Medium Priority
?
369 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
Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

 
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 200 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

705 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