Symbian3/SDK/Source/GUID-1B58FBA8-4E2C-5A99-A4B7-D7475E1B8F96.dita
changeset 0 89d6a7a84779
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Symbian3/SDK/Source/GUID-1B58FBA8-4E2C-5A99-A4B7-D7475E1B8F96.dita	Thu Jan 21 18:18:20 2010 +0000
@@ -0,0 +1,23 @@
+<?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-1B58FBA8-4E2C-5A99-A4B7-D7475E1B8F96"><title>How to use wrapping</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>After any operation which resizes the <keyword>text
+        area</keyword>, the wrapping width may need to be changed. The code in this section resets the view rectangle, and then resets the wrapping width accordingly.</p> <ul><li id="GUID-0027B472-465C-537F-8F40-641997F362A1"><p>Resize the view rectangle (an instance of class <xref href="GUID-101762DC-E498-3325-88AB-B0FF17DC62B6.dita"><apiname>TRect</apiname></xref>) by shrinking it by forty pixels in both directions.</p> </li> <li id="GUID-49E7E1FD-C954-5097-B11F-AE0FF9ED9384"><p>Reset the view rectangle using <xref href="GUID-CF377A98-F11F-380F-AD10-7F3E261D4421.dita#GUID-CF377A98-F11F-380F-AD10-7F3E261D4421/GUID-3D04D758-B829-34C6-9B22-C51F58D0316C"><apiname>CTextView::SetViewRect()</apiname></xref>.</p> </li> </ul> <codeblock id="GUID-1F0FBF4A-BF54-5926-A7B6-564E8136646B" xml:space="preserve">iViewRect.Shrink(40,40);
+iTextView-&gt;SetViewRect(iViewRect);
+iTextView-&gt;HandleGlobalChangeL(); 
+    // update formatting and draw the completely revamped view</codeblock> <p>The following code sets the wrapping width to be the width of the new view rectangle minus the total margin width, so that text wraps at the right hand edge of the view rectangle.</p> <ul><li id="GUID-BF3388F7-13D4-5C72-959E-751CDA7D9C10"><p>To ensure that text wrapping is set, use <xref href="GUID-FEE7C848-2E93-3848-A3DA-7EAA533615AF.dita#GUID-FEE7C848-2E93-3848-A3DA-7EAA533615AF/GUID-B8C93ECC-1BEA-321F-AF2A-AF534212900F"><apiname>CTextLayout::DisableWrapOverride(EFalse)</apiname></xref>. By default, wrapping is set.</p> </li> <li id="GUID-B27EE3E1-0716-563B-9063-5A3463412636"><p>As the wrapping width is a global document characteristic, changes to it may be handled using <xref href="GUID-CF377A98-F11F-380F-AD10-7F3E261D4421.dita#GUID-CF377A98-F11F-380F-AD10-7F3E261D4421/GUID-903D1087-42CB-32EB-8379-7B019936AD16"><apiname>CTextView::HandleGlobalChangeL()</apiname></xref>.</p> </li> </ul> <codeblock id="GUID-C92925E0-AE52-507E-93AA-7653BE7107B9" xml:space="preserve">// Wrap text to new view rectangle
+TInt labelsWidth,lineCursorWidth;
+// Get both margin widths
+iTextView-&gt;MarginWidths(labelsWidth,lineCursorWidth);
+// New wrap width = new view rect width minus total margin width
+iLayout-&gt;SetWrapWidth(iViewRect.Width()-(labelsWidth+lineCursorWidth));
+iLayout-&gt;DisableWrapOverride(EFalse); // Ensure wrapping on
+iTextView-&gt;HandleGlobalChangeL();</codeblock> </conbody></concept>
\ No newline at end of file