![]() |
Disabling menu items |
Post Reply
|
| Author | |
Damsku
Newbie
Joined: 14 April 2007 Location: Finland Status: Offline Points: 17 |
Post Options
Thanks(0)
Quote Reply
Topic: Disabling menu itemsPosted: 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
|
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
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 |
|
![]() |
|
Damsku
Newbie
Joined: 14 April 2007 Location: Finland Status: Offline Points: 17 |
Post Options
Thanks(0)
Quote Reply
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
|
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |