在MFC中更新工具栏按钮状态 [英] Updating toolbar button state in MFC

查看:514
本文介绍了在MFC中更新工具栏按钮状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MFC应用程序中有一个对话框,它有菜单栏。现在,我使用菜单栏中的相同命令在该对话框中创建了一个工具栏。

I have a dialog in MFC application, which was having menu-bar. Now I have created a toolbar in that dialog using the same command which was in the menu-bar.

我用来更新菜单项的状态,并按照某些检查启用/禁用,当我点击菜单时。但是对于工具栏,我没有得到这些调用来更新它的状态,如果应该启用/禁用它。

I use to update the menu-item's state and makes it enable/disable as per some check, When I clicks on the menu. But for toolbar I didn't gets these calls to update it's state, If it should be enabled/disabled.

此外,当测试失败时我没有任何通知,而且我要禁用该项目。

Moreover I didn't have any notification when the test fails and I to disable the item.

是否有替代方案这样做?

Is there some alternative for doing this?

谢谢

推荐答案

在基于对话框的应用程序中未提供使文档/视图应用程序中的ON_UPDATE_COMMAND_UI工作的MFC代码。你可以自己添加它,如本文所示:

The MFC code that makes ON_UPDATE_COMMAND_UI work in a doc/view app is not provided in a dialog based app. You can add it yourself as shown in this article:

http://www.codeproject.com/Articles/2350/CDialogEx-CPropertySheetEx2-classes-with-status-ba

http://www.codeproject.com/Articles/2350/CDialogEx-CPropertySheetEx2-classes-with-status-ba

 


这篇关于在MFC中更新工具栏按钮状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆