Print Page | Close Window

Disabling menu items

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=7001
Printed Date: 12 November 2025 at 5:46pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Disabling menu items
Posted By: Damsku
Subject: Disabling menu items
Date 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



Replies:
Posted By: Oleg
Date 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


Posted By: Damsku
Date 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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net