Symbian3/PDK/Source/GUID-1501D056-D068-5DE4-9408-17B530D75FC3.dita
author Graeme Price <GRAEME.PRICE@NOKIA.COM>
Fri, 15 Oct 2010 14:32:18 +0100
changeset 15 307f4279f433
parent 14 578be2adaf3e
permissions -rw-r--r--
Initial contribution of the Adaptation Documentation.

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept xml:lang="en" id="GUID-1501D056-D068-5DE4-9408-17B530D75FC3"><title>How to implement scrolling</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>The code in this section demonstrates horizontal and vertical scrolling using <xref href="GUID-CF377A98-F11F-380F-AD10-7F3E261D4421.dita#GUID-CF377A98-F11F-380F-AD10-7F3E261D4421/GUID-12D47A64-3236-37D0-9513-1B1ED817679A"><apiname>CTextView::ScrollDisplayL()</apiname></xref>. This function can be used to scroll text horizontally (left or right and to the start or end of a <keyword>line</keyword>), and vertically (page or line up, page or line down). Note that scrolling down means that the text appears to move upwards, scrolling left means it appears to move rightwards.</p> <section><title>Scroll left</title> <p>The following code scrolls the display left by 40 pixels, causing the text to move right. If no horizontal scroll jump value is set, the scroll jump will be the default value of 20 pixels.</p> <codeblock id="GUID-5FAEF14C-D6B9-54B3-A343-57BC9677DAFD" xml:space="preserve">iTextView-&gt;SetHorizontalScrollJump(40); // scroll jump is 40 pixels
iTextView-&gt;ScrollDisplayL(TCursorPosition::EFLeft); // scroll left</codeblock> </section> <section><title>Scroll down</title> <p>The following example scrolls the display downwards. </p> <ul><li id="GUID-06405640-5C83-56BD-AAB4-58FEB4A5F27A"><p>Use <codeph>ScrollDisplayL()</codeph> until the end of the document is reached, at which point <codeph>ScrollDisplayL()</codeph> returns zero.</p> </li> <li id="GUID-83C0BCD3-0F16-5AE4-BCCD-2531F1D287CA"><p>Here, the scroll includes blank space (the second argument is <xref href="GUID-FEE7C848-2E93-3848-A3DA-7EAA533615AF.dita#GUID-FEE7C848-2E93-3848-A3DA-7EAA533615AF/GUID-6B04A5DA-7AE9-3E57-B9C8-F429995CD44E"><apiname>CTextLayout::EFAllowScrollingBlankSpace</apiname></xref>), so scrolling continues until the last line in the document reaches the top of the display. By default, blank space is not scrolled, in which case the scroll ends when the last line appears at the bottom of the display.</p> </li> </ul> <codeblock id="GUID-37067073-ED67-5E5C-B437-5A1FC8444076" xml:space="preserve">TInt pixelsScrolled;
do pixelsScrolled=iTextView-&gt;ScrollDisplayL
    (TCursorPosition::EFLineDown,CTextView::EFAllowScrollingBlankSpace);
while (pixelsScrolled);</codeblock> <p><b>Note</b> </p> <ul><li id="GUID-7C8BFA2E-8ABC-58ED-8B4B-04CB199596B9"><p>Vertical scrolling can also be carried out using <xref href="GUID-CF377A98-F11F-380F-AD10-7F3E261D4421.dita#GUID-CF377A98-F11F-380F-AD10-7F3E261D4421/GUID-58307513-AAFA-3984-A603-B8CD94637804"><apiname>CTextView::ScrollDisplayPixelsL()</apiname></xref>, <xref href="GUID-CF377A98-F11F-380F-AD10-7F3E261D4421.dita#GUID-CF377A98-F11F-380F-AD10-7F3E261D4421/GUID-A06D2AE8-2470-3CC2-B115-F645234A76C9"><apiname>CTextView::ScrollDisplayLinesL()</apiname></xref>, or <xref href="GUID-CF377A98-F11F-380F-AD10-7F3E261D4421.dita#GUID-CF377A98-F11F-380F-AD10-7F3E261D4421/GUID-7EFDA6BC-161B-3219-911A-5994FEC714FD"><apiname>CTextView::ScrollDisplayParagraphsL()</apiname></xref> to move the text by a number of pixels, lines and paragraphs respectively.</p> </li> </ul> </section> </conbody></concept>