How to show available windows in the Window menu

487 views Asked by At

I have a MFC MDI application that I've recently ported from VS2003 to VS2008, and at the same time moved from Stingray Objective Studio 2006 v2 to v10.1. On the previous versions of my application, if I had more than one view open, the Window menu would be populated by an enumerated list of available views, e.g. 1 MyViewA, 2 MyViewB etc... If I had a large number of views, I would also get a Windows... menu option to allow me to select a view. This no longer happens, which is breaking some of my GUI level regression tests. My guess is that this functionality was implemented by either CMDIFrameWnd or SECMDIFrameWnd but I couldn't find a reference to it in the documentation. Does anyone know how I can get this functionality back.

1

There are 1 answers

1
Aidan Ryan On

First thing I'd do is create a new MDI application with the ClassWizard and check if the functionality you're missing is present. If so, poke around and see if you can tell what's different. One place to look may be the menu resource for the main menu.

If there is no in-built functionality to provide what you need, you can dynamically build the menu with the following pseudocode:

foreach registered CDocumentTemplate 
    foreach document
        foreach view
        {
            if (numberOfWindowMenuItems < 5)
            {
                Add menu item
            }
            else
            {
                Add "Windows..." menu item
                break all loops;
            }