Pregunta

I'm converting an existing application to use ribbon. I'm using visual studio 2012. I tried to add buttons through QAT properties editor in the ribbon designer. The QAT shown in the Test Ribbon mode correctly. But It's not shown when I debugging the application. The dropdown box button is there but not functional.

I've also tried to add buttons in code, but it makes no difference:

    MFCRibbonQuickAccessToolBarDefaultState qatState;
    qatState.AddCommand(ID_FILE_SAVE);
    qatState.AddCommand(ID_EDIT_UNDO);
    m_wndRibbonBar.SetQuickAccessDefaultState(qatState);

Any idea would be appreciated. The part of QAT in ribbon1.mfcribbon-ms is:

<QAT_ELEMENTS><ELEMENT_NAME>QAT</ELEMENT_NAME><QAT_TOP>TRUE</QAT_TOP><ITEMS><ITEM><ID><NAME>ID_FILE_NEW</NAME><VALUE>57600</VALUE></ID><VISIBLE>TRUE</VISIBLE></ITEM><ITEM><ID><NAME>ID_FILE_OPEN</NAME><VALUE>57601</VALUE></ID><VISIBLE>TRUE</VISIBLE></ITEM></ITEMS></QAT_ELEMENTS>
¿Fue útil?

Solución

I solved it. In the CAppnameApp::InitInstance() function in the Appname.cpp, call InitContextMenuManager() function. This initialize the CContextMenuManager object which manage shortcut menus. This object is introduced in VC2008. Also other functions like InitShellManager(); InitKeyboardManager(); InitTooltipManager();need to be called at the same place.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top