Question Locked

c++ help with EnableMenuItem

0 helpful
15 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

i am looking to gray out the submenu option department and manager in my sort menu
if i select a option in the filter
the code that i have is
CMenu* pMenu = GetParent()->GetMenu();
CMenu* submenu = pMenu->GetSubMenu(0);

//pMenu->EnableMenuItem(3,MF_BYPOSITION|MF_GRAYED);
submenu->EnableMenuItem(ID_SORT_MANAGER,MF_BYPOSITION | MF_GRAYED);
submenu->EnableMenuItem(ID_SORT_DEPARTMENT,MF_BYPOSITION | MF_GRAYED);

GetParent()->DrawMenuBar();
OnSortName();

15 replies

by older mycroft

Sorry, but I'm pretty sure you told me something after [i]"there is some thing that i am missing.."[/i] But it never came through.

Please re-transmit. ;)

by jean_guy_bureau

what am i missing i have look in the page you sent me did not work
i did some chage to my code what is missing or what am i missing

CMenu* pMenu = GetParent()->GetMenu();
CMenu* submenu = pMenu->GetSubMenu(0);

//pMenu->EnableMenuItem(3,MF_BYPOSITION|MF_GRAYED);
submenu->EnableMenuItem(ID_SORT_MANAGER,MF_BYCOMMAND | MF_GRAYED|MF_DISABLED);
submenu->EnableMenuItem(ID_SORT_DEPARTMENT,MF_BYCOMMAND | MF_GRAYED|MF_DISABLED);

GetParent()->DrawMenuBar();
OnSortName();

by older mycroft

SPACE - TIME continuum.

Take some time and check the SPACE you have between your [line] values.

You appear to be incapable of checking the SPACING of your typing. ;)

[b][u]HINT:[/b][/u]

Cut & Paste the example from the M$ webpage, into Notepad, place the cursor in front of the top left character, then using the 'advance' cursor key - do a character count of the values.

Do the same for your own code.

Do it line for line.

The example has spaces that you don't. ;)

by jean_guy_bureau

CMenu* pMenu = GetParent()->GetMenu();
CMenu* submenu = pMenu->GetSubMenu(0);

submenu->EnableMenuItem(ID_SORT_MANAGER,MF_BYCOMMAND | MF_GRAYED | MF_DISABLED);

submenu->EnableMenuItem(ID_SORT_DEPARTMENT,MF_BYCOMMAND | MF_GRAYED | MF_DISABLED);
GetParent()->DrawMenuBar();
OnSortName();

by older mycroft

That you are NOT American - that you are French Canadian ????

That's like asking me to guess the skin colour of the Invisible Man!! ;)

by older mycroft

Now, pardon me if I'm wrong, but your command of the English language appears to be substantive. Now notwithstanding the fact that you are American, and may have formed your own methodology of formatting written English, there are still a few constraints that have to be adhered to, one of which is that [b]after every comma there is usually a [u]SPACE[/u].[/b] This conformity is not just confined to [i]written[/i] English

Sorry, if that is beyond your understanding then, that is wholly your concern. I DO NOT wish to be harsh, but if you cannot read then why are you asking questions within a text-based forum ?

I also suggest you attempt to develop a personal sense of humour. ;)

by jean_guy_bureau

I i did put a space and the Comma
And the sudmenu are still not going gray
CMenu* pMenu = GetParent()->GetMenu();
CMenu* submenu = pMenu->GetSubMenu(0);

submenu->EnableMenuItem(ID_SORT_MANAGER, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);

submenu->EnableMenuItem(ID_SORT_DEPARTMENT, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
GetParent()->DrawMenuBar();

by older mycroft

I'm going to give you a simple piece of advice...

If you are incapable of viewing 2 pieces of code side-by-side (or one above the other), making adjustments as you go, you will never make it to the point of achievement.

I gave you the chance, you DID make amendments, never admitted them then maintained there was no difference. You can't do that if I'm snap-shotting what you post.

READ the code - don't just look at it. ;)

by older mycroft

"MF_BYCOMMAND"

&

"MF_BYPOSITION"

...so why the juxtapose?

You changed the code... ;)

by jamesrl

Tu ne parle pas la Francais Canadian, moi non plus!

James

This discussion is closed to new replies.