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 » Problem with scrollbars Collapse All
Subject Author Date
Robert Webb Jun 22, 2009 - 3:23 AM

Hi,


It seems there’s a problem in CExtScrollBar::ScrollBar_TrackMouseLButtonDown().  You’ll find this code:



                if( bUpStep )
                {
                    nScrollPos -= nStepSize;
                    if( nScrollPos < _psbd.m_DSI.nMin )
                        nScrollPos = _psbd.m_DSI.nMin;
                } // if( bUpStep )
                else
                {
                    nScrollPos += nStepSize;
                    if( nScrollPos > nMx )
                        nScrollPos = nMx;
                } // else from if( bUpStep )
                if( _GetScrollPos( true ) != nScrollPos )


The problem is that we need a WM_VSCROLL message sent back even if the scrollbar is already at its limit.  I believe this is how the standard MFC scrollbar works (which is why our code used to work).  The last line above means that messages are only sent back when Prof-UIS internal scroll position has changed, but we need the message anyway.


Can you fix this?


Thanks,


Rob.

Robert Webb Jun 23, 2009 - 11:32 PM

Hmm, using this patch and setting m_bSendEqualNotifications to true doesn’t seem to make any difference.  And looking at the code changes I can’t see why it would.  In fact, the following just looks like a bug to me:



if( bUpStep )
{
    nScrollPos -= nStepSize;
    if( nScrollPos < _psbd.m_DSI.nMin || m_bSendEqualNotifications )
        nScrollPos = _psbd.m_DSI.nMin;
} // if( bUpStep )
else
{
    nScrollPos += nStepSize;
    if( nScrollPos > nMx )
        nScrollPos = nMx;
} // else from if( bUpStep )

The extra check in the first part means that when m_bSendEqualNotifications is true, going up a line or page will ALWAYS set the scroll pos to the minimum.  What’s that about?  And whatever the logic, why isn’t something similar required for the line-down case?


What we need is to still receive scroll events, in particular we need SB_LINEDOWN and SB_LINEUP messages even when the scrollbar is already at the end, and these still don’t come through.


The only message we get now when trying to scroll past the end is SB_ENDSCROLL after the mouse is released


However, I have managed to work around the problem by manipulating the scrollbar range so we still get events when we need them.


I do still think it’s a bug though that events like SB_LINEDOWN are not forwarded through regardless of where the scroll thumb is.  If the caller is handling such messages, then they will already be doing bounds checks and should know what they’re doing.  For example, what if they wish to grow the scroll range upon attempts to scroll off the end?


But for now, we have a solution for our problem.


Thanks,


Rob.

Technical Support Jun 24, 2009 - 12:57 PM

Yes, you are right. The m_bSendEqualNotifications property must be used only in conditions like if( m_bSendEqualNotifications || _GetScrollPos( true ) != nScrollPos ). Please download the fixed version:

http://www.prof-uis.com/download/forums/tmp/UpdatedScrollBar-2-For-RobertWebb.zip

Technical Support Jun 23, 2009 - 8:30 AM

We added a new CExtScrollBar::m_bSendEqualNotifications property. It’s set to false by default. You can change it to true so that you can receive scrolling notifications. Here is the updated .../Prof-UIS/Include/ExtScrollWnd.h and .../Prof-UIS/Src/ExtScrollWnd.cpp files:

http://www.prof-uis.com/download/forums/tmp/UpdatedScrollBarForRobertWebb.zip