Solved

Graying Popup Menu Items

Posted on 1997-11-03
7
361 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Login Script to Copy Folders 12 29
Expand LInux Boot partition remotly 3 86
ASCII Non-Printable characters/codes and their HTML equivalents 6 106
sumHeights2  challenge 7 89
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
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.

863 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now