Menu items disabled but appear enabled
-
I am disabling some menu items based on a condition but after some dialog launch in the application, these menu item appearance changes to those of enabled. However, when I click them their appearance changes to that of a disabled button. I can also do this by simply switching focus or simply by minimize-restore of application. Why does the menu item change appearance? How can I prevent that from happening?
-
I am disabling some menu items based on a condition but after some dialog launch in the application, these menu item appearance changes to those of enabled. However, when I click them their appearance changes to that of a disabled button. I can also do this by simply switching focus or simply by minimize-restore of application. Why does the menu item change appearance? How can I prevent that from happening?
Is this an MFC application? How are you disabling the menu items? From where, and how, are you launching the dialog box?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
-
Is this an MFC application? How are you disabling the menu items? From where, and how, are you launching the dialog box?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
Yes this is a MFC application which works similar to the CProperty sheet wizard style but with CDialogs. I am disabling the menu items in the frame class when the first dialog appears at start of the application but somewhere in between when other dialogs come up the appearance of the disabled menu items is changing from disabled to enabled.
-
Yes this is a MFC application which works similar to the CProperty sheet wizard style but with CDialogs. I am disabling the menu items in the frame class when the first dialog appears at start of the application but somewhere in between when other dialogs come up the appearance of the disabled menu items is changing from disabled to enabled.
To enable/disable menu items it is best practice to use the ON_UPDATE_COMMAND_UI message. It also best practice to use a SDI (with a CFormView) application if menus are needed.
Watched code never compiles.
-
I am disabling some menu items based on a condition but after some dialog launch in the application, these menu item appearance changes to those of enabled. However, when I click them their appearance changes to that of a disabled button. I can also do this by simply switching focus or simply by minimize-restore of application. Why does the menu item change appearance? How can I prevent that from happening?
Hi, It sounds to me as if your doing something that is screwing up the MFC command routing. However based on your brief description I have no ideas as to what it could be. Did you check to see if the menu items have a unique resource ID? Best Wishes, -David Delaune
-
To enable/disable menu items it is best practice to use the ON_UPDATE_COMMAND_UI message. It also best practice to use a SDI (with a CFormView) application if menus are needed.
Watched code never compiles.
Thanks for your advice. But turns out if you try to disable the menubar items after system creates window, you need to call DrawMenuBar(). Source of explanation: http://stackoverflow.com/questions/1835209/how-can-i-disable-and-gray-the-top-level-menu-item-using-mfc?answertab=oldest#tab-top[^] This solves my problem... Hope this helps anyone else having similar issues.
-
I am disabling some menu items based on a condition but after some dialog launch in the application, these menu item appearance changes to those of enabled. However, when I click them their appearance changes to that of a disabled button. I can also do this by simply switching focus or simply by minimize-restore of application. Why does the menu item change appearance? How can I prevent that from happening?
-
Is it solved now? regards Vatsa www.objectiveprogramming.com[^]
Yes my problem is solved. As replied earlier calling DrawMenuBar()solved my issue. Please refer to: http://stackoverflow.com/questions/1835209/how-can-i-disable-and-gray-the-top-level-menu-item-using-mfc[^] for more details.
-
Yes my problem is solved. As replied earlier calling DrawMenuBar()solved my issue. Please refer to: http://stackoverflow.com/questions/1835209/how-can-i-disable-and-gray-the-top-level-menu-item-using-mfc[^] for more details.
-
Hi, I see that you showed your EnableMenuItem() function on stackoverflow. If you would have gave us a better description and shown that function here on codeproject you would have recieved a much better response. Best Wishes, -David Delaune
Sorry for the confusion, let me explain. The StackOverflow post was not me, it was a reference. I could not post my code online... Company policy. However, thanks for your concern in trying to help me solve my problem. I shall continue to approach you guys in future.