?
Solved

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

Posted on 2004-10-06
4
Medium Priority
?
215 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
[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
  • 2
4 Comments
 
LVL 45

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 45

Accepted Solution

by:
AndyAinscow earned 500 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

Technology Partners: 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

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 …
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…
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.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

650 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