Solved

Graying Popup Menu Items

Posted on 1997-11-03
7
364 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
  • 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
Independent Software Vendors: 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

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!

Question has a verified solution.

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

Suggested Solutions

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.

713 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