473,322 Members | 1,352 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

menus and MDI


hi,

i'm still having troubles with my menus

the EnableMenuItem function doesn't seem to work at all
in a MDI. i'm doing exactly the same thing as i did when
i coded a dialog based App with a menu, but it worked.

i just want to disable and gray commands in the menu.
And even when i disable it in the properties in the
ressource editor, it does nothing.

and the stranger is that when i use ModifyMenu,
it transform the menu item into a separator!!.

am i smoking too much or Frames don't let me do anything
with the menu?

i almost forgot but it does the same with my popup menu which
is created with CMenu::LoadMenu and is not a part of my frame...

i give a piece of code but it's has i explain :

BOOL CMdiApp::InitInstance()
{
// create main MDI Frame window
CMainFrame* pMainFrame = new CMainFrame;
if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
return FALSE;

CMenu *menu = pMainFrame->GetMenu()->GetSubMenu(0);

menu->EnableMenuItem(IDM_BOUNCE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
menu->ModifyMenu(IDM_HELLO, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);

pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->UpdateWindow();
m_pMainWnd = pMainFrame;

// load the two static menus
return TRUE;
}

thanks,

--
lucas
Nov 17 '05 #1
2 1121
>i'm still having troubles with my menus

the EnableMenuItem function doesn't seem to work at all
in a MDI.


Enable/disable the menu item in the command's ON_UPDATE handler -
which is executed just prior to the menu being displayed. See "Message
Handling and Mapping" in MSDN for more information.

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
Nov 17 '05 #2
Le Fri, 01 Apr 2005 00:31:37 +0100, David Lowndes <da****@example.invalid>
a écrit:
i'm still having troubles with my menus

the EnableMenuItem function doesn't seem to work at all
in a MDI.


Enable/disable the menu item in the command's ON_UPDATE handler -
which is executed just prior to the menu being displayed. See "Message
Handling and Mapping" in MSDN for more information.

Dave


thanks, it was that. i could do it by setting m_bAutoMenuEnable to FALSE
wich prevents the ON_UPDATE mechanism.

--
lucas
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: chart43 | last post by:
I have question about the technique for css dropdown menus described in http://www.alistapart.com/articles/horizdropdowns/. Based on an html list, it has a few items in a 1st order list and further...
7
by: Marci | last post by:
I found this script for cascading menus, however, I cannot reach the author to solve the bug I am having when I add a second menu to it. My problem is this: If I click on the first link, the...
2
by: Pete | last post by:
In Access 95/97 I used to be able to create pull down menus (File,Edit ...) from a macro. It seems there used to be some wizard for that. However in Access 2000 it seems you have to build your...
1
by: cefrancke | last post by:
I have set the Startup properties to the following... All menus, toolbars, etc are turned off plus these are unchecked Allow Full Menus Allow Built-in Toolbars Allow Default Shortcut Menus...
3
by: cefrancke | last post by:
The only reason I ask is that no one has made this subject clear or given a definitive answer. What I would like to do is, after turning off all the menus/tbars/etc using the startup options. ...
0
by: cefrancke | last post by:
I recently discovered, that if you set the startup options for "security", you will have alot of work do to get Access back to "normal". If you disable the built-in menus/toolbars you'll have to...
4
by: Karl Irvin | last post by:
I distribute an A 2000 app as a mde. On a few customers, my custom menus are overwritten. The top menu is generally there but the choices on the menus are gone or replaced by something else. ...
0
by: Keith | last post by:
When merging two menus, it doesn't actually merge their sub menus and menu items It only displays two menus on one forms instead of merging two sub menus into one if they have sam menu text ...
3
by: Steven Smith | last post by:
the way I'm undersatnding the MSDN documentation when creating parent and child forms the main menu for the child form should not be displayed on the child form itself but instead be incorporated...
0
by: ARC | last post by:
Hello all, For right-click (shortcut) menus in access 2007, I've been using a round-about method of opening access 97 on an old computer, modifying my own custom shortcut menus, then importing...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.