Sometimes, body or div holds many data, scrolling line by line is not a
good choice. Scrolling by page will be a better one. Now I had already
implemented this feature.
1) Two new commands defined in htmlstrings.h file:
__LIT(KHStrPageDown, "page-down");
__LIT(KHStrPageUp, "page-up");
2) In CHtmlElementDiv::InvokeL, add the following code:
else if(cmd.CompareF(KHStrPageDown)==0)
{
if (iScrollbar)
iScrollbar->PageDown();
}
else if(cmd.CompareF(KHStrPageUp)==0)
{
if (iScrollbar)
iScrollbar->PageUp();
}
3) In class CHcScrollbar, add PageUp() and PageDown() as follows:
void CHcScrollbar::PageUp()
{
iPos -= iDiv->iDisplayRect.Height();
if (iPos < 0)
iPos = 0;
}
void CHcScrollbar::PageDown()
{
iPos += iDiv->iDisplayRect.Height();
if (iPos > iMax)
iPos = iMax;
}
4) How to use it? It's simple, just call one line of code:
iControl->Body()->InvokeL(KHStrPageUp); // or use KHStrPageDown instead
and then refresh the control.
iControl->RefreshAndDraw();
If you can add me as a contributor, I can merge this feature into trunk
soon.
Original issue reported on code.google.com by douyongw...@gmail.com on 17 May 2010 at 6:38
Original issue reported on code.google.com by
douyongw...@gmail.com
on 17 May 2010 at 6:38