开发者

How is the Windows menu in a MFC C++ app populated

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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜