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
Solved

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

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Host to IP 7 80
Complete beginner needs help making a cron job 9 125
How to determine file rename from EventLog ? 2 55
Smart Camera scanning and reading information 3 113
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 …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

828 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