Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » Showing all Menu Items Collapse All
Subject Author Date
Merlin Avery Sep 19, 2002 - 10:24 AM

Showing only the most recently used menuu items is a nice feature, but I need to disable it in my current project. I have a plugin system that registers document/views from other DLLs and it’s totally dynamic so it’s impossible for the parent project to figure out which menu items to show by default. Instead of trying to make a work-around I’d like to disable the feature completely and just show everything, how would I go about doing this?

Your help is very much appreciated.

Sergiy Lavrynenko Sep 30, 2002 - 11:40 AM

Hi Merlin Avery.

There are two ways to do this:

1) put these lines into your initialization code

CExtPopupColorMenuWnd::g_bMenuExpanding = false;
CExtPopupColorMenuWnd::g_bMenuHighlightRarely = false;

2) use g_CmdManager->SetBasicCommands(...) to set all your commands as basic i.e. initially visible in menus.

I recommend you to use the first way.

Best regards

Hyeon-woo Jeong Sep 21, 2002 - 3:22 AM


How about this?

vector<UINT> MenuList;
SetFavoriteMenu(MenuList, IDR_MAINFRAME, -1);
UINT* arrnBasicCommands = new UINT[(int)MenuList.size()];
vector<UINT>::iterator it;
for(it=MenuList.begin(), i=0; it!=m_MenuList.end(); it++, i++)
arrnBasicCommands[i] = *it;

VERIFY(
g_CmdManager->SetBasicCommands(
pApp->m_pszProfileName,
arrnBasicCommands
)
);

delete [] arrnBasicCommands;



void CMainFrame::SetFavoriteMenu(vector<UINT>& MenuList, UINT nResourceID, ...)
{
    va_list marker;
    int i = nResourceID;
    int a, b, c = 0;

    va_start(marker, nResourceID);
    while(i != -1)
    {
        CMenu MainMenu;
        MainMenu.LoadMenu(i);
        for(a=0; a<MainMenu.GetMenuItemCount(); a++)
        {
            CMenu* pMenu = MainMenu.GetSubMenu(a);
            for(b=0; b<pMenu->GetMenuItemCount(); b++)
            {
                int nID = pMenu->GetMenuItemID(b);
                if(nID > 0)
                {
                    CString str;
                    pMenu->GetMenuString(nID, str, MF_BYCOMMAND);
                    MenuList.push_back(nID);
                }
                else if(nID == -1) // Popup Menu ( I support only 1 level depth. )
                {
                    CMenu* pSubMenu = pMenu->GetSubMenu(b);
                    for(c=0; c<pSubMenu->GetMenuItemCount(); c++)
                    {
                        int nID = pSubMenu->GetMenuItemID(c);
                        if(nID > 0)
                        {
                            CString str;
                            pSubMenu->GetMenuString(nID, str, MF_BYCOMMAND);
                            MenuList.push_back(nID);
                        }
                    }
                }

            }
        }
        i = va_arg(marker, int);

    }
    va_end(marker);
    MenuList.push_back(0);
}
I also want to disable it, but I can’t find the solution about it.
So, I found the other way like this.

you can’t diabled it, but u can set favorite all menu items.

I’m make it to support only 1 level depth of the menu, but u can modify my source to support free-level depth.

and, my source is very dirty. --; ( plz, if you have excellent skill, edit my code ˆˆ;

P.S. English is very difficult ...

Sergiy Lavrynenko Sep 30, 2002 - 11:54 AM

Dear Hyeon-woo Jeong,

Thank you for your comment, but I only have one sugestion: you do not need to allocate memory for a single call of g_CmdManager->SetBasicCommands(). It can be called unlimited times with the pointer to the following array:


// local variable in the stack
UINT arrnBasicCommands[] =
{
nSingleCommandID,
0, // end of list
}

// now call g_CmdManager->SetBasicCommands()
// to set one command as basic