Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Disabling menu items
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Disabling menu items

 Post Reply Post Reply
Author
Message
Damsku View Drop Down
Newbie
Newbie


Joined: 14 April 2007
Location: Finland
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote Damsku Quote  Post ReplyReply Direct Link To This Post Topic: Disabling menu items
    Posted: 27 April 2007 at 6:57am
Hi,

I have an action i shouldn't be running when it's running already, and i want to gray an item in the menu after selecting it.
I do set the menu this way:
        if (GetCommandBars()->SetMenu(_T("Menu Bar"), IDR_MAINFRAME) == NULL) return -1;

I tried GetCommandBars()->GetMenuBar()->GetMenu() to access the CMenu and operate with the items, but GetMenu returns null...
GetCommandBars()->GetMenuBar()->GetControl(index) it disables the submenu but i can't find a way to access items in the submenu from there...
What is the proper way to remotely enable/disable a menu?
Thanks in advance

damsku
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 30 April 2007 at 4:05am
Hello,
 
Use update handlers to enable/disable items.
see ON_UPDATE_COMMAND_UI in MSDN.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Damsku View Drop Down
Newbie
Newbie


Joined: 14 April 2007
Location: Finland
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote Damsku Quote  Post ReplyReply Direct Link To This Post Posted: 02 May 2007 at 2:17am
Well, i need to disable the menu when i click on a toolbar button so that would work like that. If i got msdn right...
damsku
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.047 seconds.