Solved

How to check a selected menu-item and its upper popup??

Posted on 2004-10-06
4
196 Views
Last Modified: 2013-11-20
Hi,

I have a MFC application (single document). I've created a menu in the resource editor.
The menu has one pop-up menu 'test'.
In this popup-menu there's another pop-up menu 'test2'. This menu  consists of one item 'test3'.
Problem : if I select 'test3' by clicking on it, I want to check menu-item 'test3' AND popup 'test2'.
I don't succeed in checking popup 'test2'.
How should I do this in MFC ?

IDR_MENU1 MENU DISCARDABLE
BEGIN
    POPUP "test"
    BEGIN
        POPUP "test2"
        BEGIN
            MENUITEM "test3",                       ID_TEST_TEST2_TEST3
        END
    END
END

thx
jlsjls

0
Comment
Question by:jlsjls
  • 2
4 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 12238364
Add a handler for the updating of the menu in the main frame (or wherever you have the command handler).  Class wizard, select the menu ID and UPDATE_COMMAND_UI.

void CMainFrame::OnUpdateMenuHauptbuch(CCmdUI* pCmdUI)
{
      pCmdUI->Enable(true);//or false to enable/disable
      pCmdUI->SetCheck(true);//or false to display check
}

I don't think you can put a check next to the menu item that launches a sub menu (does it make sense? as a sub menu can have a number of items).
0
 
LVL 3

Author Comment

by:jlsjls
ID: 12238481
My problem is like you said 'How to check a menu item that launches a sub menu'.
I want this feature since it gives to the user a clear indication to what has been selected before in a menu consisting out of different menu-levels.
0
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 250 total points
ID: 12238621
I understand but if the sub menu has two items does it mean both are checked or just one?  If it has only one sub item then why have a popup menu.

My first thoughts are this isn't going to be very clear to the end user.  If you really require this then you may have to resort to owner draw menus.  A posssible alternative is to ignore the SetCheck support and display bitmaps with your menus.  (A blank rectangle and a tick mark) and modify the menu dynamically.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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 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.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

708 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

13 Experts available now in Live!

Get 1:1 Help Now