MFC C 中的 Windows 菜单如何?应用程序已填充
Windows 菜单是为 MFC 下的文档/视图应用程序提供的标准菜单之一。它提供诸如平铺和层叠窗口之类的功能,并在菜单末尾附加当前可用视图的枚举列表。问题是,有时不会,我想知道为什么。更具体地说,我想知道如何刷新此列表,因为我想在 GUI 自动化工具下使用它。通常列表是有的,有时没有,有人知道为什么吗?我的猜测是 CFrameWnd 类深处有一个函数来处理这个问题,但我似乎找不到它。
编辑:我还在使用 GUI 的 Stingray 库,这很可能与问题有关。
One of the standard menus provided to a Document/View app under MFC is the Windows menu. It provides things like tiling and cascading windows, and appends an enumerated list of currently available views at the end of the menu. Problem is, sometimes it doesn't and I'd like to know why. More specifically, I'd like to know how to refresh this list as I'd like to use it under a GUI automation tool. Usually the list is there, sometimes it's not, anyone know why? My guess is that there is a function deep within the CFrameWnd class to look after this but I can't seem to find it.
Edit: I'm also using the Stingray library for GUI which could well have a bearing on the problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
更新菜单和窗口标题有两种方法分别处理。
CFrameWnd::OnUpdateFrameMenu(..)
仅实现框架菜单,CFrameWnd::OnUpdateFrameTitle(..)
仅刷新框架名称。我认为某个地方的调用顺序错误,更新标题将晚于更新菜单。毕竟,窗口菜单中的标题有时仍然是空字符串。
最简单的修复方法是使用
GetActiveFrame()->ActivateFrame()
方法调用。它将立即刷新实际的框架窗口和拥有的窗口菜单。创建CDocument和CView后即可使用。调用它的最佳位置是在应用程序的 (CWin)App 类的
OnFileNew
、OnFileOpen
重写方法的末尾。Updating the menu and the window title are handled separatelly in two methods.
CFrameWnd::OnUpdateFrameMenu(..)
actualises only the frame menu,CFrameWnd::OnUpdateFrameTitle(..)
refreshes only the name of the frame.I think there is somewhere a wrong call order and updating the title will be later than updating the menu. After all that title in Window menu remains an empty string sometimes.
The simplest way to repair is by using the
GetActiveFrame()->ActivateFrame()
method call. It will refresh immediatelly the actual frame window and the owned Window menu too.It can be used after creating the CDocument and the CView. The best place to call it is in end of
OnFileNew
,OnFileOpen
overridden methods of (CWin)App class of application.