Symbian3/PDK/Source/GUID-530DBEB3-2379-5567-BB10-45D21D6FF80A.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Fri, 22 Jan 2010 18:26:19 +0000
changeset 1 25a17d01db0c
child 3 46218c8b8afa
permissions -rw-r--r--
Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
     1
<?xml version="1.0" encoding="utf-8"?>
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
     2
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
     3
<!-- This component and the accompanying materials are made available under the terms of the License 
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
     4
"Eclipse Public License v1.0" which accompanies this distribution, 
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
     5
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
     6
<!-- Initial Contributors:
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
     7
    Nokia Corporation - initial contribution.
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
     8
Contributors: 
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
     9
-->
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    10
<!DOCTYPE concept
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    11
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    12
<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;
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    13
TUint scanMask=CPlainText::EScanToUnitEnd;
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    14
iRichText-&gt;ScanParas(pos,scanMask); // get end pos of 1st para
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    15
// move cursor to end of para and select it
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    16
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>