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 » CExtRibbonNodeFile Collapse All
Subject Author Date
Sergio Buonanno Sep 27, 2010 - 3:58 AM

Should CExtRibbonNodeFile object have a particular structure ? I’m trying to add a Ribbon file menu with just 2 buttons. One to connect top a Database and one to exit the application. I copied the code from the RibbonBarMDI sample. But when I call m_wndRibbonBar.Ribbon_FileButtonGet() I get a NULL pointer.

The code fragment from my application is:

///////////////////////////////////////////////////////////////////////////////////////
    // File menu
    CExtRibbonNodeFile *pRibbonNodeFile = InitRibbon_FileMenu();
    m_pRootRibbonNode->InsertNode(NULL, pRibbonNodeFile);
    ///////////////////////////////////////////////////////////////////////////////////////

    //VERIFY(m_wndRibbonBar.MenuInfoGetDefault()->AccelTableLoad(IDR_MAINFRAME));

    if (!bReset)
        pRibbonNodeTabPageCollection->PageSelectionSet(0);
    else
        pRibbonNodeTabPageCollection->PageSelectionSet(1);

    m_wndRibbonBar.SetButtons(m_pRootRibbonNode);
    VERIFY(m_wndRibbonBar.MenuInfoGetDefault()->AccelTableLoad(IDR_MAINFRAME));

    m_wndRibbonBar.Ribbon_FileButtonInit();

    bool bSmallFileButtonIcon = g_PaintManager->Ribbon_IsSystemMenuIconPresent() ? true : false;
    LPCTSTR strFileButtonIconResID = bSmallFileButtonIcon ? (MAKEINTRESOURCE(IDB_LOGO_LARGE)) : (MAKEINTRESOURCE(IDB_LOGO_SMALL));
    CExtRibbonButtonFile *pFileMenu = m_wndRibbonBar.Ribbon_FileButtonGet();
    pFileMenu->m_iconForLargeMode.m_bmpNormal.LoadBMP_Resource(strFileButtonIconResID);

pFileMenu is NULL and I cannot change the bitmap. If I remove the last 2 lines of code, no menu appears.

Dan Bilan Apr 17, 2021 - 3:02 PM

Employees of the firm are experienced graduates who write papers in various disciplines https://www.launchora.com/story/requirements-for-mbacom-assignment-help , so they can work on time in keeping with the deadline. We guarantee that despite the speed of writing you will get a quality job. We comply with all the requirements and regulations in any case. All you have to do is leave a request on the site and inform us about all the important nuances and deadlines that we must take into account.

Technical Support Sep 29, 2010 - 9:04 AM

The Office 2007 themes require a 32x32 icon to display inside the ribbon file button. The Office 2010 themes require a 16x16 icon. The CMainFrame::NcFrameImpl_SyncThemeSettings() method in the RibbonBar sample application reloads 32x32 or 16x16 icons for the ribbon file button.

Sergio Buonanno Sep 29, 2010 - 9:44 AM

Yes, I have set the icon exactly the same way as in RibbonBarMDI_1000 project. I implemented also CMainFrame::NcFrameImpl_SyncThemeSettings() which is called during CMainFrame creation but the result is always the same. Please take a look at the pictures I have sent to your support email account.

Technical Support Sep 28, 2010 - 11:23 AM

The CExtRibbonBar::m_bFileTabButtonDisplaysText flag property affects the content of the file button when it uses a tab like shape.

Sergio Buonanno Sep 29, 2010 - 1:31 AM

error C2039: ’m_bFileTabButtonDisplaysText’ : is not a member of ’CExtRibbonBar’

I searched for m_bFileTabButtonDisplaysText in Prof-UIS 2.90 and I didn’t find it. I’m still having 2 problems that I can show you through a picture if you give me an email address where to send it. The file TAB appears as a blue box without caption or icon (just a blank blue box) and the caption bar of the application is heigher than normal (almost double than normal size), the application icon is painted twice, one in the upper left corner of the main window (system menu) and one below the first one, and the area below the main window caption bar is painted in a faded black. To restore the normal aspect of the application I must resize it using the mouse. RecalcLayout() and Ribbon_UpdateLayout don’t work.

Sergio Buonanno Sep 29, 2010 - 1:22 AM

error C2039: ’m_bFileTabButtonDisplaysText’ : is not a member of ’CExtRibbonBar’

Technical Support Sep 29, 2010 - 9:05 AM

Yes, it’s present in 2.91 only. You can drop us an e-mail to the support mail box at this web site so we will provide you with the update.

Sergio Buonanno Sep 29, 2010 - 9:15 AM

I have sent you two emails. Thanks.

Technical Support Sep 27, 2010 - 12:02 PM

The ribbon file button is a restyled version of the ribbon gallery button. The ribbon file button never appears as an in-place gallery in the ribbon bar. It always collapsed into a button. The popup gallery menu of the ribbon file button is just a restyled version of a popup ribbon gallery menu and the gallery toolbox is placed on the right. There are no special rules to initialize the ribbon file button. We think you should just invoke the m_wndRibbonBar.Ribbon_FileButtonInit(); line of code before m_wndRibbonBar.SetButtons(m_pRootRibbonNode);. Or simply move the m_wndRibbonBar.SetButtons(m_pRootRibbonNode); line of code to the bottom.

Sergio Buonanno Sep 28, 2010 - 3:49 AM

There is something wrong because your solution doesn’t work in my application. I moved the lines of code you told me, but nothing, same result, CExtRibbonButtonFile *pFileMenu = m_wndRibbonBar.Ribbon_FileButtonGet() returns a NULL pointer in pFileMenu.

In the previous post I wrote the function that builds the ribbon bar, below I write the function that builds the Ribbon File Menu:

CExtRibbonNodeFile *CMainFrame::InitRibbon_FileMenu()
{
    CString sConn, sClose;
    CExtRibbonNodeFile *pRibbonNodeFile = new CExtRibbonNodeFile;

    pRibbonNodeFile->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’F’) ) ), false );
    pRibbonNodeFile->m_keyTipOptionsButton.KeyCodeAdd( DWORD(’T’) );
    pRibbonNodeFile->m_keyTipExitButton.KeyCodeAdd( DWORD(’X’) );
    CExtCustomizeCmdScreenTip * pCmdScreenTip = new CExtCustomizeCmdScreenTip;
    pCmdScreenTip->CaptionMainSet( _T("Application Button") );
    pCmdScreenTip->TextMainSet( _T("Click here to open, save or print,\nand to see everything else you can\ndo with the document.") );
    pCmdScreenTip->BmpMainGet().LoadBMP_Resource(MAKEINTRESOURCE(ID_FILE_DLB_TIP_IMAGE));
    pCmdScreenTip->BmpMainGet().Make32();
    pCmdScreenTip->BmpMainGet().AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
    pRibbonNodeFile->CmdScreenTipAttach( pCmdScreenTip );
    
    sConn.LoadString(ID_FILE_CONNECTION);
    CExtRibbonNode * pNodeFileConn =    new CExtRibbonNode(ID_FILE_CONNECTION, ID_FILE_CONNECTION, NULL, __ECTN_BIG_ACCENT_IN_MENU, NULL, _T("&New..."));
    pNodeFileConn->CmdKeyTipSet(new CExtCustomizeCmdKeyTip(__EXT_MFC_SAFE_TCHAR(_T(’C’))), false);
    VERIFY(pNodeFileConn->m_iconBig.m_bmpNormal.LoadBMP_Resource(MAKEINTRESOURCE(IDB_RB_CONN_CONNECTION_LARGE)));
    pNodeFileConn->m_iconBig.m_bmpNormal.Make32();
    pNodeFileConn->m_iconBig.m_bmpNormal.AlphaColor(RGB(255,0,255), RGB(0,0,0), 0);
    pCmdScreenTip = new CExtCustomizeCmdScreenTip;
    pCmdScreenTip->TextMainSet(sConn);
    pNodeFileConn->CmdScreenTipAttach(pCmdScreenTip);
    pRibbonNodeFile->InsertNode(NULL, pNodeFileConn);

    sClose.LoadString(IDS_CLOSE_IDEALE);
    CExtRibbonNode * pNodeFileClose = new CExtRibbonNode(ID_FILE_CLOSE, ID_FILE_CLOSE, NULL, __ECTN_BIG_ACCENT_IN_MENU | __ECTN_GROUP_START, NULL, sClose);
    pNodeFileClose->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’C’) ) ), false );
    VERIFY(pNodeFileClose->m_iconBig.m_bmpNormal.LoadBMP_Resource(MAKEINTRESOURCE(IDB_FILE_CLOSE)));
    pNodeFileClose->m_iconBig.m_bmpNormal.Make32();
    pNodeFileClose->m_iconBig.m_bmpNormal.AlphaColor(RGB(255,0,255), RGB(0,0,0), 0);
    pCmdScreenTip = new CExtCustomizeCmdScreenTip;
    pCmdScreenTip->TextMainSet(sClose);
    pNodeFileClose->CmdScreenTipAttach(pCmdScreenTip);
    pRibbonNodeFile->InsertNode(NULL, pNodeFileClose);

    return pRibbonNodeFile;
}

Then I do not understand the meaning of the bitmap with id: ID_FILE_DLB_TIP_IMAGE. It looks like a snapshot of the menu, but I don not understand why I must add it.

Technical Support Sep 28, 2010 - 11:23 AM

The ID_FILE_DLB_TIP_IMAGE image is displayed on the screen tip of the file button. It’s optional.

The ribbon file button is instantiated in the CExtRibbonBar::Ribbon_FileButtonInit() virtual method which is invoked directly from the CExtRibbonBar::SetButtons() virtual method. It must be instantiated and not NULL after the CExtRibbonBar::SetButtons() method is invoked. If it’s NULL, then you probably any of these methods were overridden and preventing creation of ribbon file button. For example, the FormulaGrid sample application demonstrates the ribbon bar without the file button.

Sergio Buonanno Sep 28, 2010 - 1:20 PM

CExtRibbonBar::Ribbon_FileButtonInit() was taken from another sample application, it was overridden and its body consisted of just the line "return false". I removed the function to let the base class method be called, now a blue box appears instead of the text "File ", but there is also a design issue, the caption bar looks "dirty" and higher with the application icon doubled on a black background and to reset the application to the the normal aspect I must resize the main window. I tried to call RecalcLayout and Ribbon_UpdateLayout after CExtRibbonBar::SetButtons() and at the end of CMainFrame::OnCreate without success.

Sergio Buonanno Sep 28, 2010 - 6:55 AM

I have another question. I tried to build a demo project of my own. I succeeded to show the Ribbon File node in the demo project, but I couldn’t show the bitmap instead of the "File" text. I’m trying to get a clue on that but I’m losing a lot of time debugging your code. Can you help me to get the bitmap shown ?

It is really important to have a sort of documentation on the Ribbon control. What I succeeded to put in place in a few hours with the MFC version of that control it is taking me days of precious time to understand with Prof-UIS. The lack of documentation in such a feature reach control it is causing major problems. It is not imaginable to learn how to use it just taking a look at the samples, it is also quite intricate and a rather simple Ribbon bar with Prof-UIS could need several hundreds of lines of code.