Symbian3/SDK/Source/GUID-DC0E3782-82EF-5104-937C-41F24DF1E1CA.dita
changeset 0 89d6a7a84779
equal deleted inserted replaced
-1:000000000000 0:89d6a7a84779
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept xml:lang="en" id="GUID-DC0E3782-82EF-5104-937C-41F24DF1E1CA"><title>How to set the cursor</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>The code in this section sets the <keyword>line cursor
       
    13         margin</keyword> and line and <keyword>text cursor</keyword> visibility. In order to display the text cursor, a window group must have been set when the text view was constructed. Alternatively, one may be set by calling <xref href="GUID-CF377A98-F11F-380F-AD10-7F3E261D4421.dita#GUID-CF377A98-F11F-380F-AD10-7F3E261D4421/GUID-B9282DE0-09BF-308C-8105-61272B79AC80"><apiname>CTextView::SetDisplayContextL()</apiname></xref>. Before a <keyword>line
       
    14         cursor</keyword> can be displayed, the line cursor margin width must be set and a bitmap line cursor must be specified. </p> <p>The following code sets the <keyword>line cursor
       
    15         margin</keyword> width to 20 pixels and the <keyword>label
       
    16         margin</keyword> width to zero.</p> <ul><li id="GUID-ADDB082D-EB96-5FA7-9533-CDEF32D4C8F7"><p>After the margin width is set, call <xref href="GUID-CF377A98-F11F-380F-AD10-7F3E261D4421.dita#GUID-CF377A98-F11F-380F-AD10-7F3E261D4421/GUID-F30E2687-36D6-3C7E-AE6C-7735981853F2"><apiname>CTextView::DrawL()</apiname></xref> to ensure the line cursor will be visible.</p> </li> <li id="GUID-61752E09-7AFA-595A-95B1-6D2DF75FCDE8"><p>Load in the bitmap used to represent the line cursor. </p> </li> <li id="GUID-AA9E0A3E-5247-5B88-B70F-2302815FC715"><p>Call <xref href="GUID-CF377A98-F11F-380F-AD10-7F3E261D4421.dita#GUID-CF377A98-F11F-380F-AD10-7F3E261D4421/GUID-DA488293-4E53-32B6-A852-C28AC9ECEACE"><apiname>CTextView::SetCursorVisibilityL()</apiname></xref> to select both cursors for display.</p> </li> </ul> <codeblock id="GUID-9CF0ACFB-574A-5664-AFC2-9263F8888D56" xml:space="preserve">iTextView-&gt;SetMarginWidths(0,20);
       
    17         // zero label margin, 20 pixel line cursor margin
       
    18 iTextView-&gt;DrawL(iViewRect); // required to update the view 
       
    19 // Set bitmap to represent line cursor. First load it in.
       
    20 iBitmap=new(ELeave) CFbsBitmap();
       
    21 iBitmap-&gt;Load(_L("\\data\\CURSORS.MBM"));
       
    22 iTextView-&gt;SetLineCursorBitmap(iBitmap);
       
    23 iTextView-&gt;SetCursorVisibilityL(TCursor::EFBothCursors);</codeblock> </conbody></concept>