Scrolling in a small wxVListBox with tall items (i.e. taller than the height
of wxVListBox itself) behaved wrongly: wrong item was being scrolled into view
and Page Up/Down didn't scroll as much as they should.
Fix both of these problems by checking for these corner cases explicitly.
Closes #13454.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69180
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
{
// it is, indeed, only partly visible, so scroll it into view to
// make it entirely visible
{
// it is, indeed, only partly visible, so scroll it into view to
// make it entirely visible
+ // BUT scrolling down when m_current is first visible makes it
+ // completely hidden, so that is even worse
while ( (size_t)m_current + 1 == GetVisibleRowsEnd() &&
while ( (size_t)m_current + 1 == GetVisibleRowsEnd() &&
+ (size_t)m_current != GetVisibleRowsBegin() &&
ScrollToRow(GetVisibleBegin() + 1) ) ;
// but in any case refresh it as even if it was only partly visible
ScrollToRow(GetVisibleBegin() + 1) ) ;
// but in any case refresh it as even if it was only partly visible
+#include "wx/utils.h" // For wxMin/wxMax().
+
// ============================================================================
// wxVarScrollHelperEvtHandler declaration
// ============================================================================
// ============================================================================
// wxVarScrollHelperEvtHandler declaration
// ============================================================================
}
else if ( evtType == wxEVT_SCROLLWIN_PAGEUP )
{
}
else if ( evtType == wxEVT_SCROLLWIN_PAGEUP )
{
- return FindFirstVisibleFromLast(m_unitFirst);
+ // Page up should do at least as much as line up.
+ return wxMin(FindFirstVisibleFromLast(m_unitFirst),
+ m_unitFirst ? m_unitFirst - 1 : 0);
}
else if ( evtType == wxEVT_SCROLLWIN_PAGEDOWN )
{
}
else if ( evtType == wxEVT_SCROLLWIN_PAGEDOWN )
{
+ // And page down should do at least as much as line down.
- return GetVisibleEnd() - 1;
+ return wxMax(GetVisibleEnd() - 1, m_unitFirst + 1);
- return GetVisibleEnd();
+ return wxMax(GetVisibleEnd(), m_unitFirst + 1);
}
else if ( evtType == wxEVT_SCROLLWIN_THUMBRELEASE )
{
}
else if ( evtType == wxEVT_SCROLLWIN_THUMBRELEASE )
{