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 » CExtGridBaseWnd, disabling auto-hide of the scroll bar Collapse All
Subject Author Date
a a Apr 10, 2006 - 3:04 AM

I disabled the auto-hiding of the horizontal scroll bar by overriding OnSwCanAutoHideScrollBar, like this:

bool DataGrid::OnSwCanAutoHideScrollBar(bool bHorz) const
{
if (bHorz)
return false;
return DYNDataGrid::OnSwCanAutoHideScrollBar(bHorz);
}

But the problem is that the last row may be covered by the scroll bar by resizing the datagrid,
and the vertical scroll bar doesn’t appear even if that happens.
How do you exclude the scroll bar (with auto-hide disabled) from the client area in this case?

Technical Support Apr 10, 2006 - 11:38 AM

The scroll bar spaces and mutual visibility of the horizontal/vertical scroll bars are managed automatically by methods of the CExtScrollWnd class. We do not see any problems with non-hidable scroll bars.

a a Apr 10, 2006 - 7:22 PM

Then how do you explain the phenomenon of the screen shots? (did you check them?)

CExtScrollWnd is definitely not managing the scroll bar spaces correctly, when the programmer redefines the auto-hiding method.

visible and enabled => OK. The scroll bar space DOESN’T belong to the client area.
visible but disabled => Not managed. The scroll bar space DOES belong to the client area.
not visible => OK. The scroll bar space DOESN’T belong to the client area.

> We do not see any problems with non-hidable scroll bars.
Did you ever check?
If this kind of case isn’t managed, what’s the use of OnSwCanAutoHideScrollBar?

Technical Support Apr 11, 2006 - 7:07 AM

We received your e-mail, modified your project and sent it back to you. The modified version of your project shows a ready-to-use solution for always invisible vertical scroll bar and enabled vertical scrolling as you need.

a a Apr 11, 2006 - 8:11 PM

Thanks a lot for the demo project.
It helped me making the vertical scroll bar invisible and enabled.

But this is another issue.
Disabling the auto-hide of the horizontal scroll bar results in the following strange behaviours:
- Scroll bar drawn over the last row when resizing the control, vertical scroll bar doesn’t appear unless the last row reaches
the bottom of the control (not the bottom of client area but under the horizontal scroll bar).
(occurs always when the scroll bar is disabled)
- Selection of the last row is not detected, or not drawn, though double-clicking is detected (in-place editing works even though the cell isn’t selected)
(occurs always when the scroll bar is disabled, and when the last row is fully visible)
- EnsureVisible makes the last row appear at the bottom of the control (not the bottom of client area, it appears under the horizontal scroll bar)
(occurs sometimes when the last row is half visible and when the user clicks on it)

Technical Support Apr 13, 2006 - 8:42 AM

We used the same project to test the problem. We overrode the OnSwCanAutoHideScrollBar() virtual method to make the horizontal scroll bar always visible:

virtual bool OnSwCanAutoHideScrollBar( bool bHorz ) const
{
    ASSERT_VALID( this );
    bHorz;
    return false;
}
We cannot confirm the problems described in your message. In fact, the grid window correctly changes the scrolling position but, in case of the bottom row, the grid simply becomes not repainted. At present, we found only one, not very optimal solution for this problem. It is based on overriding the OnSwDoScrollBy() virtual method like as follows:
virtual bool OnSwDoScrollBy( CSize sizeScroll, bool bDoScroll = true )
{
bool bRetVal = CExtGridWnd::OnSwDoScrollBy( sizeScroll, bDoScroll );
    if( bRetVal )
        OnSwInvalidate( true );
    return bRetVal;
}