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 » CExtNCSB problem in 2.83 Collapse All
Subject Author Date
Offer Har May 8, 2008 - 7:48 AM

I have a multi-line edit box - I tried to skin it with the new CExtNCSB template.


The problem is as follows:


1) When there is only one line, the scroll-bars are disabled, which is OK:



2) But, when there are two lines, the scroll-bars should stay disabled, and it doesn’t (note the side of the handle - the minimal):



3) The scroll-bar should become enabled only when the text is bigger then the size of the edit-box, this is the standard behavior - you can see that the handle also gets the right size:


Technical Support May 24, 2008 - 6:15 AM

It is fixed. Please update the following method in the declaration of the CExtNCSB_Impl template class:

      virtual void NCSB_RescanChannel( bool bHorizontal )
      {
            ASSERT_VALID( this );
            if( NCSB_IsDestructionMode() || GetSafeHwnd() == NULL )
                  return;
            CExtNCSB_ScrollContainer * pWnd =
                  NCSB_GetContainer(
                        bHorizontal
                              ? CExtNCSB_ScrollContainer::__EM_HORIZONTAL_SCROLL_BAR
                              : CExtNCSB_ScrollContainer::__EM_VERTICAL_SCROLL_BAR
                        );
            if( pWnd == NULL )
                  return;
            ASSERT( pWnd->GetSafeHwnd() != NULL );
            CExtScrollBar * pScrollBar = pWnd->GetScrollBarInContainer();
            if( pScrollBar == NULL )
                  return;
            ASSERT( pScrollBar->GetSafeHwnd() != NULL );
            BOOL bWindowEnabled = IsWindowEnabled();
            pWnd->EnableWindow( bWindowEnabled );
            SCROLLINFO _scroll_info_window, _scroll_info_bar;
            ::memset( &_scroll_info_window, 0, sizeof(SCROLLINFO) );
            ::memset( &_scroll_info_bar, 0, sizeof(SCROLLINFO) );
            _scroll_info_window.cbSize = sizeof(SCROLLINFO);
            _scroll_info_bar.cbSize = sizeof(SCROLLINFO);
            if( bWindowEnabled )
            {
                  NCSB_GetScrollInfoWindow( bHorizontal, _scroll_info_window );
                  NCSB_GetScrollInfoBar( pScrollBar, _scroll_info_bar );
            }
            if( ::memcmp( &_scroll_info_window, &_scroll_info_bar, sizeof(SCROLLINFO) ) != 0 )
            {
                  if( m_bNcsbUse32BitScrollInfo )
                        pScrollBar->SetScrollInfo( &_scroll_info_window, FALSE );
                  else
                  {
                        pScrollBar->SetScrollRange( _scroll_info_window.nMin, _scroll_info_window.nMax, FALSE );
                        pScrollBar->SetScrollPos( _scroll_info_window.nPos, FALSE );
                  }
            }
            BOOL bEnable =
                  (     bWindowEnabled
                  &&    ( _scroll_info_window.nMin < _scroll_info_window.nMax )
                  &&    (     _scroll_info_window.nPage == 0
                        ||    INT( _scroll_info_window.nMax - _scroll_info_window.nMin + 1 ) > INT(_scroll_info_window.nPage)
                        )
                  ) ? TRUE : FALSE;
            pScrollBar->EnableWindow( bEnable );
            pScrollBar->Invalidate();
            pScrollBar->UpdateWindow();
      }
Please also note that by default the CExtNCSB template class does not work with the CListCtrl control. We implemented a specialized version of this template class for the list view common control in the latest code.