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 » Possible bug in CExtControlBar::_CalcDesiredLayout() Collapse All
Subject Author Date
Bob Schwammerl Mar 30, 2009 - 5:15 AM

Hello,


I was looking for a class with fixed size that only contains a dialog child window just like CExtPanelControlBar. Unfortunately this class cannot be docked to resizable windows like CExtControlBar, because it acts like a toolbar.


So I wrote a class deriving from CExtControlBar with CBRS_GRIPPER disabled ( to deactivate the window caption/frame ) which overwrites the _CalcDesiredMinHW() and _CalcDesiredMinVH() functions.


But somehow, the min. dimensions were always square, so I traced the computation back to CExtControlBar::_CalcDesiredLayout() where I found this:



        if( m_sizeDockedH.cy < _CalcDesiredMinHW() )
            m_sizeDockedH.cy = _CalcDesiredMinHW();


and similiar code blocks for vertical/floating docking. Assuming that W stands for width, at least the terminology sounds odd ( comparing y to width ). So I changed it to



        if( m_sizeDockedH.cx < _CalcDesiredMinHW() )
            m_sizeDockedH.cx = _CalcDesiredMinHW();


and the window was as I expected it to be. My sample project was the SDI-sample with a modified dialog child window.


 


Best regards


 


 


 


 

Technical Support Mar 30, 2009 - 12:28 PM

Thank you for reporting this issue. Here is the fix:

CSize CExtControlBar::_CalcDesiredLayout(
            BOOL bHorz,
            BOOL bForceFullRow // = FALSE
            )
{
            ASSERT_VALID( this );
            if( IsFloating() )
                        return m_sizeFloated;
            if( bHorz )
            {
                        if( bForceFullRow )
                                    return CSize( MAXSHORT, m_sizeDockedH.cy );
                        CSize sizeMin( _CalcDesiredMinHW(), _CalcDesiredMinVH() );
                        if( m_sizeDockedH.cx < sizeMin.cx )
                                    m_sizeDockedH.cx = sizeMin.cx;
                        if( m_sizeDockedH.cy < sizeMin.cy )
                                    m_sizeDockedH.cy = sizeMin.cy;
                        return m_sizeDockedH;
            } // if( bHorz )
            else
            {
                        if( bForceFullRow )
                                    return CSize( m_sizeDockedH.cx, MAXSHORT );
                        CSize sizeMin( _CalcDesiredMinHW(), _CalcDesiredMinVH() );
                        if( m_sizeDockedV.cx < sizeMin.cx )
                                    m_sizeDockedV.cx = sizeMin.cx;
                        if( m_sizeDockedV.cy < sizeMin.cy )
                                    m_sizeDockedV.cy = sizeMin.cy;
                        return m_sizeDockedV;
            } // else from if( bHorz )
}