Professional UI Solutions
Site Map   /  Register


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 » Bug in WidthFromContent function Collapse All
Subject Author Date
Ralph Stadie May 11, 2010 - 8:10 AM


There seems to be a bug in the way that the WidthFromContent function of CExtStatusBar behaves for certain themes on Windows 7 (and presumably Vista).

For example, if I run the standard ZoomScrollBar sample and select the VS2005 theme, the text in the status pane is truncated, however if I select one of the newer themes, such as Office 2007, then it’s ok.  Loosely, I’ve determined that only appears to work correctly for the Office 2007 and Office 2010 themes and for all the rest the text is truncated.

I’ve only noticed this behaviour on Windows 7, as it seemed to work fine on Windows XP (I can’t confirm what it’s like on Vista).

It’s not a serious issue as the workaround is to select one of the newer Office themes, but I thought I’d point it out in case anyone can offer up a simple solution to fix it.



Technical Support May 11, 2010 - 12:55 PM

Thank you for reporting this issue. To fix it please update the source code for the following method:

void CExtStatusControlBar::WidthFromContent( int nIndex )
            ASSERT_VALID( this );
            ASSERT((nIndex >= 0 && nIndex < m_nCount) || m_nCount == 0);
_STATUSBAR_PANE_ * pPane = GetPanePtr( nIndex );
            ASSERT( pPane != NULL );
            if( pPane == NULL )
CRect rcText(0,0,0,0);
            if( !pPane->strText.IsEmpty() )
                        HFONT hFont = (HFONT)PmBridge_GetPM()->m_FontNormal.GetSafeHandle();
                        CClientDC dcScreen( NULL );
                        HGDIOBJ hOldFont = NULL;
                        if( hFont != NULL )
                                    hOldFont = dcScreen.SelectObject( hFont );
                                    GetPaneDrawTextFlags( nIndex ) | DT_CALCRECT
                        if( hOldFont != NULL )
                                    dcScreen.SelectObject( hOldFont );
            } // if( !pPane->strText.IsEmpty() )
CStatusBarCtrl & _ctrl = GetStatusBarCtrl();
            // ICON 2.53
CSize szIcon = CSize(0,0);
//          if( hIcon != NULL )
//                      szIcon = CExtCmdIcon::stat_GetIconSize( hIcon );
            if( hIcon != NULL )
                        CExtCmdIcon _icon;
                        _icon.AssignFromHICON( hIcon, false );
                        szIcon = _icon.GetSize();
               + rcText.Width() + 2

Ralph Stadie May 12, 2010 - 2:46 AM

Thanks - that did the trick!