For some reason we computed scroll increment from the native message and not
the new position directly which is actually simpler and probably would have
never resulted in a bug which exchanged the meanings of SB_TOP and SB_BOTTOM.
Get rid of nScrollInc and just update the position variable directly.
Closes #11741.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63587
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
- int position = scrollInfo.nPos;
int maxPos = scrollInfo.nMax;
// A page size greater than one has the effect of reducing the effective
int maxPos = scrollInfo.nMax;
// A page size greater than one has the effect of reducing the effective
if ( m_pageSize > 1 )
maxPos -= (m_pageSize - 1);
if ( m_pageSize > 1 )
maxPos -= (m_pageSize - 1);
+ int position = scrollInfo.nPos;
wxEventType scrollEvent = wxEVT_NULL;
wxEventType scrollEvent = wxEVT_NULL;
switch ( wParam )
{
case SB_TOP:
switch ( wParam )
{
case SB_TOP:
- nScrollInc = maxPos - position;
scrollEvent = wxEVT_SCROLL_TOP;
break;
case SB_BOTTOM:
scrollEvent = wxEVT_SCROLL_TOP;
break;
case SB_BOTTOM:
- nScrollInc = -position;
scrollEvent = wxEVT_SCROLL_BOTTOM;
break;
case SB_LINEUP:
scrollEvent = wxEVT_SCROLL_BOTTOM;
break;
case SB_LINEUP:
scrollEvent = wxEVT_SCROLL_LINEUP;
break;
case SB_LINEDOWN:
scrollEvent = wxEVT_SCROLL_LINEUP;
break;
case SB_LINEDOWN:
scrollEvent = wxEVT_SCROLL_LINEDOWN;
break;
case SB_PAGEUP:
scrollEvent = wxEVT_SCROLL_LINEDOWN;
break;
case SB_PAGEUP:
- nScrollInc = -GetPageSize();
+ position -= GetPageSize();
scrollEvent = wxEVT_SCROLL_PAGEUP;
break;
case SB_PAGEDOWN:
scrollEvent = wxEVT_SCROLL_PAGEUP;
break;
case SB_PAGEDOWN:
- nScrollInc = GetPageSize();
+ position += GetPageSize();
scrollEvent = wxEVT_SCROLL_PAGEDOWN;
break;
case SB_THUMBPOSITION:
case SB_THUMBTRACK:
scrollEvent = wxEVT_SCROLL_PAGEDOWN;
break;
case SB_THUMBPOSITION:
case SB_THUMBTRACK:
- nScrollInc = scrollInfo.nTrackPos - position;
+ position = scrollInfo.nTrackPos;
scrollEvent = wParam == SB_THUMBPOSITION ? wxEVT_SCROLL_THUMBRELEASE
: wxEVT_SCROLL_THUMBTRACK;
break;
case SB_ENDSCROLL:
scrollEvent = wParam == SB_THUMBPOSITION ? wxEVT_SCROLL_THUMBRELEASE
: wxEVT_SCROLL_THUMBTRACK;
break;
case SB_ENDSCROLL:
scrollEvent = wxEVT_SCROLL_CHANGED;
break;
scrollEvent = wxEVT_SCROLL_CHANGED;
break;
-
- default:
- nScrollInc = 0;
+ if ( position != scrollInfo.nPos )
- position += nScrollInc;
-
if ( position < 0 )
position = 0;
if ( position > maxPos )
if ( position < 0 )
position = 0;
if ( position > maxPos )