-// TODO:
-/*
- *viewStart = ::GetScrollPos((HWND)m_hWnd, SB_CTL);
- *viewLength = m_viewSize;
- *objectLength = m_objectSize;
- *pageLength = m_pageSize;
-*/
-}
-#endif
-
-WXHBRUSH wxScrollBar::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
- WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
+ SBCDATA vInfo;
+ //
+ // The lRange (number of scroll steps) is the
+ // object length minus the page size.
+ //
+ int nRange1 = wxMax((m_nObjectSize - m_nPageSize), 0);
+
+ m_nViewSize = nPageSize;
+ m_nPageSize = nThumbSize;
+ m_nObjectSize = nRange;
+
+
+ //
+ // Try to adjust the lRange to cope with page size > 1
+ // (see comment for SetPageLength)
+ //
+ if (m_nPageSize > 1 )
+ {
+ nRange1 += (m_nPageSize - 1);
+ }
+ vInfo.cb = sizeof(SBCDATA);
+ vInfo.cVisible = m_nPageSize;
+ vInfo.posFirst = 0;
+ vInfo.posLast = nRange1;
+ vInfo.posThumb = nPosition;
+
+ ::WinSendMsg((HWND)GetHwnd(), WM_SETWINDOWPARAMS, (MPARAM)&vInfo, (MPARAM)NULL);
+} // end of wxScrollBar::SetScrollbar
+
+WXHBRUSH wxScrollBar::OnCtlColor (
+ WXHDC hDC
+, WXHWND hWnd
+, WXUINT uCtlColor
+, WXUINT uMessage
+, WXWPARAM wParam
+, WXLPARAM lParam
+)