[wx-dev] PG DN and PG UP of wxVListBox
Azriel Fasten
fst911 at gmail.com
Thu Apr 3 23:58:49 PDT 2008
Currently the code for handling PG DN and PG UP in OnKeyDown of wxVListBox
is:
case WXK_PAGEDOWN:
PageDown();
current =3D GetVisibleBegin();
break;
case WXK_PAGEUP:
if ( m_current =3D=3D (int)GetVisibleBegin() )
{
PageUp();
}
current =3D GetVisibleBegin();
break;
Ok, so there are two problems,
1. case WXK_PAGEDOWN: if the page is not scrolled ( suppose it all
fits ), PageDown() has no effect, and current goes to the top, resulting=
in
PG *DN* going *up*. Obviously wxListBox's behaviour is different as
well.
2. case WXK_PAGEUP: a more subtle problem, it doesnt match wxListBox
behaviour, as the first PG UP will not PageUp at all, rather just select=
the
current first visible item, unless the current item is the current first
visible item.
wxListBox's behaviour is the same for both up and down ( note that I only
tested wxListBox on wxMSW ). For PG DN*, *it makes the currently selected
item the top item ( ScrollToLine ) and then selects the last visible item.
For PG UP, it makes the currently selected item the bottom item, and then
selects the first visible item. For PG UP, a design choice has to be made
about which behaviour suites it most, the current behaviour, or to emulate
wxListBox behavior.
Preliminary code to solve #1:
case WXK_PAGEDOWN:
//go down a page
ScrollToRow( m_current );
//select the last ( fully ) visible item. GetVisibleEnd()
returns last item +1 ( therefore subtract 1 ),
//fixme: however sometimes that item is only partialy visible
and normal behaviour would be to subtract another
current =3D GetVisibleEnd() - 1;
break;
I wasn't able to effectively emulate PG UP correctly.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wx-dev/attachments/20080404/1e48a=
fca/attachment.htm
More information about the wx-dev
mailing list