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 Tech Support » Toolbar button/list becoming hidden Collapse All
Subject Author Date
Neville Franks Jul 15, 2004 - 1:21 AM

Hi,
I mentioned a problem a few weeks back where a toolbar combo becomes hidden when it shouldn’t and you asked for an example. You can download the latest Surfulater Beta from  www.surfulater.com/setupsurfulater1010.zip


If you drag the right hand toolbar to the left a little you will see the combo in the left hand toolbar become hidden. You can use get this to happen in other ways like resizing the app window.

Technical Support Jul 16, 2004 - 6:01 AM

Dear Neville,

Thank you for the bug report. The unwanted resizing was caused by incorrect calcualtion of the toolbar’s minimum horizontal width and vertical height. Please update the following code in the ExtToolControlBar.cpp file:

CSize CExtToolControlBar::_CalcDesiredMinOuterSize( BOOL bHorz )
{
 ASSERT_VALID( this );
 if( m_bPaletteMode )
  return CalcFixedLayout( FALSE, bHorz );
CSize sizeDefButton = _GetDefButtonSize();
CSize _size( 0, 0 );
 if( m_pRightBtn != NULL ) 
 {
  CClientDC dc( this );
  CFont * pOldFont =
   dc.SelectObject(
    OnGetToolbarFont(
     ( (!bHorz) && (!m_bPaletteMode) )
      ? true : false
     )
    );
  CSize sizeTBBRight =
   m_pRightBtn->CalculateLayout(
    dc,
    sizeDefButton,
    bHorz //|| m_bPaletteMode
    );
  _size += sizeTBBRight;
  if( bHorz )
   _size.cx += __EXT_TB_BUTTON_INNER_MARGIN*2;
  else
   _size.cy += __EXT_TB_BUTTON_INNER_MARGIN*2;
  dc.SelectObject( pOldFont );
 }
// if( IsFloating() )
//  return _size;

int nCountOfButtons = GetButtonsCount();
 if( nCountOfButtons > 0 )
 {
  CSize _sizeAdjust( 0, 0 );
  CClientDC dc( this );
  CFont * pOldFont =
   dc.SelectObject(
    OnGetToolbarFont(
     ( (!bHorz) && (!m_bPaletteMode) )
      ? true : false
     )
    );
  for( int nBtnIdx = 0; nBtnIdx < nCountOfButtons; nBtnIdx++ )
  {
   CExtBarButton * pTBB = _GetButtonPtr( nBtnIdx );
   ASSERT_VALID( pTBB );
   
   if( pTBB->IsSeparator() )
    continue;
   if( pTBB->GetStyle() & TBBS_HIDDEN )
    continue;

   if(  nBtnIdx == (nCountOfButtons-1)
    && m_pRightBtn != NULL
    )
   {
    ASSERT_VALID( m_pRightBtn );
    ASSERT( m_pRightBtn == pTBB );
    break;
   }
   CSize sizeTBB(
    pTBB->CalculateLayout(
     dc,
     sizeDefButton,
     bHorz
     )
    );
   if( bHorz )
   {
    if( _sizeAdjust.cx > 0 )
     _sizeAdjust.cx = min( _sizeAdjust.cx, sizeTBB.cx );
    else
     _sizeAdjust = sizeTBB;
   }
   else
   {
    if( _sizeAdjust.cy > 0 )
     _sizeAdjust.cy = min( _sizeAdjust.cy, sizeTBB.cy );
    else
     _sizeAdjust = sizeTBB;
   }
  } // for( int nBtnIdx = 0; nBtnIdx < nCountOfButtons; nBtnIdx++ )
  if( bHorz )
  {
   if( _sizeAdjust.cx > 0 )
    _size.cx += _sizeAdjust.cx + __EXT_TB_BUTTON_INNER_MARGIN*2;
  }
  else
  {
   if( _sizeAdjust.cy > 0 )
    _size.cy += _sizeAdjust.cy + __EXT_TB_BUTTON_INNER_MARGIN*2;
  }
  dc.SelectObject( pOldFont );
 } // if( nCountOfButtons > 0 )

CRect rcClient, rcWindow;
 GetClientRect( &rcClient );
 GetWindowRect( &rcWindow );
 if( bHorz )
  _size.cx += rcWindow.Width() - rcClient.Width();
 else
  _size.cy += rcWindow.Height() - rcClient.Height();

 return _size;
}