Solved

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

Posted on 2004-10-06
4
197 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

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
Need a Shell script to start a service checking the port 6 48
lucky13 challenge 11 123
sum28 challenge 31 106
tripleUp challenge 7 74
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

895 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

16 Experts available now in Live!

Get 1:1 Help Now