Search code examples
c++visual-c++user-interfacemfcstatusbar

change text of CMFCRibbonStatusBar but first character and three dot shown (like "C...")


In my project (VC++,mfc,2010) , I want change status bar text.

the variable is:

CMFCRibbonStatusBar  m_wndStatusBar;

the code is:

{

    CString strTitlePane1=_T(""); 
    m_wndStatusBar.AddElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE1, strTitlePane1,TRUE), strTitlePane1);
    m_wndStatusBar.GetElement(0)->SetText(_T("Connecting"));

}

but I see in status bar : C...

what is my problem?


Solution

  • After you've created your CMFCRibbonStatusBarPane, you need to set the expected maximum text size by calling CMFCRibbonStatusBarPane::SetAlmostLargeText.

    For example:

    CString strTitlePane1=_T(""); 
    CMFCRibbonStatusBarPane* pPane = new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE1,
                                                      strTitlePane1,TRUE);
    pPane.SetAlmostLargeText(_T("Connecting"));
    
    m_wndStatusBar.AddElement(pPane, strTitlePane1);
    m_wndStatusBar.GetElement(0)->SetText(_T("Connecting"));