Symbian3/PDK/Source/GUID-530DBEB3-2379-5567-BB10-45D21D6FF80A.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Thu, 11 Mar 2010 18:02:22 +0000
changeset 3 46218c8b8afa
parent 1 25a17d01db0c
child 5 f345bda72bc4
permissions -rw-r--r--
week 10 bug fix submission (SF PDK version): Bug 1892, Bug 1897, Bug 1319. Also 3 or 4 documents were found to contain code blocks with SFL, which has been fixed. Partial fix for broken links, links to Forum Nokia, and the 'Symbian platform' terminology issues.

<?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-530DBEB3-2379-5567-BB10-45D21D6FF80A"><title>How to select text</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>A <keyword>selection</keyword> can range from a single character to the entire document. The following example code selects the first paragraph.</p> <ul><li id="GUID-48CF7E76-4F57-56D8-8360-5EC72C012C2D"><p>The current cursor position is the start of the document (position zero). Use <xref href="GUID-49DBB305-A043-3D23-AC33-6E5C8ABAD1EE.dita#GUID-49DBB305-A043-3D23-AC33-6E5C8ABAD1EE/GUID-346EF37E-EBC7-3B4D-9EFB-3BF7BE44A5FD"><apiname>CEditableText::ScanParas()</apiname></xref> with a mask of <codeph>EScanToUnitEnd</codeph> to find the document position of the end of the paragraph containing the cursor.</p> </li> <li id="GUID-BBE5D63A-DC90-5C0A-A0C0-E20BE88210ED"><p>Use <xref href="GUID-CF377A98-F11F-380F-AD10-7F3E261D4421.dita#GUID-CF377A98-F11F-380F-AD10-7F3E261D4421/GUID-2805EB61-DAC3-30B8-B898-AD086788F6A3"><apiname>CTextView::SetDocPosL()</apiname></xref> to change the document position of the cursor to the end of the first paragraph. The second argument of <codeph>ETrue</codeph> causes the range of characters between the old and new cursor positions to be selected.</p> </li> </ul> <codeblock id="GUID-3676A534-9E1E-5144-9BDF-8DE8171E7E65" xml:space="preserve">TInt pos=0;
TUint scanMask=CPlainText::EScanToUnitEnd;
iRichText-&gt;ScanParas(pos,scanMask); // get end pos of 1st para
// move cursor to end of para and select it
iTextView-&gt;SetDocPosL(pos,ETrue);</codeblock> <section><title>Note</title> <ul><li id="GUID-85B8DD77-AF10-5F6E-B076-65CC03360217"><p>The use of <codeph>SetDocPosL()</codeph> demonstrated above shows how text can be selected using the old cursor position as the <keyword>anchor</keyword>. An alternative method of selecting text is to use <xref href="GUID-CF377A98-F11F-380F-AD10-7F3E261D4421.dita#GUID-CF377A98-F11F-380F-AD10-7F3E261D4421/GUID-EC55A292-C857-3DAC-B087-AE04DB2C0C88"><apiname>CTextView::SetSelectionL()</apiname></xref>. This function allows the user to specify the anchor as well as the cursor position.</p> </li> </ul> </section> </conbody></concept>