×
Namespaces

Variants
Actions
(Difference between revisions)

Adding scrollbars to a CEikRichTextEditor

From Nokia Developer Wiki
Jump to: navigation, search
Forum Nokia KB (Talk | contribs)
lpvalente (Talk | contribs)
m (Lpvalente -)
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
__NOTOC__
+
[[Category:Symbian C++]][[Category:UI]][[Category:Code Snippet]][[Category:Code Snippet]][[Category:S60 3rd Edition FP1]][[Category:S60 3rd Edition FP2]][[Category:S60 3rd Edition (initial release)]]
__NOEDITSECTION__
+
{{Archived|timestamp=20120804182609|user=[[User:Lpvalente|Lpvalente]]}}
  
{|style="background:#eceff2" width="660px" border="1" cellpadding="5" cellspacing="0"
+
 
|-
+
{{ArticleMetaData <!-- v1.2 -->
|'''ID''' || &nbsp;
+
|sourcecode= <!-- Link to example source code (e.g. [[Media:The Code Example ZIP.zip]]) -->
|'''Creation date''' || February 8, 2008
+
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
|-
+
|devices= Nokia E90 Communicator<br>Nokia N95 8GB
|'''Platform''' || S60 3rd Edition<br />S60 3rd Edition, FP1<br />S60 3rd Edition, FP2  
+
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
|'''Tested on devices''' || Nokia E90 Communicator<br />Nokia N95 8 GB
+
|platform= S60 3rd Edition<br/>S60 3rd Edition, FP1<br/>S60 3rd Edition, FP2
|-
+
|devicecompatability= <!-- Compatible devices (e.g.: All* (must have GPS) ) -->
|'''Category''' || Symbian C++
+
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
|'''Subcategory''' || UI
+
|signing= <!-- Empty or one of Self-Signed, DevCert, Manufacturer -->
|-
+
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
|'''APIs''' || None
+
|keywords= CEikScrollBarFrame, CEikRichTextEditor
|'''Classes''' || CEikScrollBarFrame<br />CEikRichTextEditor
+
|language= <!-- Language category code for non-English topics - e.g. Lang-Chinese -->
|-
+
|translated-by= <!-- [[User:XXXX]] -->
|'''Methods''' || None
+
|translated-from-title= <!-- Title only -->
|&nbsp; ||&nbsp;
+
|translated-from-id= <!-- Id of translated revision -->
|}
+
|review-by= <!-- After re-review: [[User:username]] -->
 +
|review-timestamp= <!-- After re-review: YYYYMMDD -->
 +
|update-by= <!-- After significant update: [[User:username]]-->
 +
|update-timestamp= <!-- After significant update: YYYYMMDD -->
 +
|creationdate= 20080208
 +
|author= [[User:Tapiolaitinen]]
 +
<!-- The following are not in current metadata -->
 +
|subcategory= UI
 +
|id= CS000823
 +
}}
  
 
==Overview==
 
==Overview==
  
In this code snippet, scrollbars are added to a rich text editor.
+
{{Abstract|This code snippet demonstrates how to add scrollbars to a rich text editor.}}
  
 
This snippet can be self-signed.
 
This snippet can be self-signed.
Line 28: Line 37:
 
==Header file==
 
==Header file==
  
<code>
+
<code cpp>
 
CEikRichTextEditor* iEditor;
 
CEikRichTextEditor* iEditor;
 
CEikScrollBarFrame* iScrollBarFrame;
 
CEikScrollBarFrame* iScrollBarFrame;
Line 35: Line 44:
 
==Source file==
 
==Source file==
  
<code>
+
<code cpp>
 
// Second phase construction.
 
// Second phase construction.
 
void CClientAppView::ConstructL(const TRect& aRect)
 
void CClientAppView::ConstructL(const TRect& aRect)
Line 51: Line 60:
 
</code>
 
</code>
  
'''Note!''' Scrollbars are not included in the inner region of the editor. This must be taken into account when drawing the editor on the screen:
+
'''Note:''' Scrollbars are not included in the inner region of the editor. This must be taken into account when drawing the editor on the screen:
  
<code>
+
<code cpp>
 
// Called whenever SetExtent(), SetSize(), SetRect(),
 
// Called whenever SetExtent(), SetSize(), SetRect(),
 
// SetCornerAndSize(), or SetExtentToWholeScreen() is
 
// SetCornerAndSize(), or SetExtentToWholeScreen() is
Line 67: Line 76:
 
     }
 
     }
 
</code>
 
</code>
 
[[Category:Symbian C++]][[Category:UI]][[Category:Code Examples]]
 

Revision as of 21:26, 4 August 2012

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

The article is believed to be still valid for the original topic scope.


Article Metadata
Tested with
Devices(s): Nokia E90 Communicator
Nokia N95 8GB
Compatibility
Platform(s): S60 3rd Edition
S60 3rd Edition, FP1
S60 3rd Edition, FP2
S60 3rd Edition FP2
S60 3rd Edition FP1
S60 3rd Edition (initial release)
Article
Keywords: CEikScrollBarFrame, CEikRichTextEditor
Created: tapiolaitinen (08 Feb 2008)
Last edited: lpvalente (04 Aug 2012)

Overview

This code snippet demonstrates how to add scrollbars to a rich text editor.

This snippet can be self-signed.

Header file

CEikRichTextEditor* iEditor;
CEikScrollBarFrame* iScrollBarFrame;

Source file

// Second phase construction.
void CClientAppView::ConstructL(const TRect& aRect)
{
// Create the rich text editor (iEditor)
// (left out for brevity)
 
// Create the scrollbar for the editor
iScrollBarFrame = iEditor->CreateScrollBarFrameL();
// Set horizontal scrollbar invisible (EOff) and vertical scrollbar
// visible (EOn)
iScrollBarFrame->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,
CEikScrollBarFrame::EOn);
}

Note: Scrollbars are not included in the inner region of the editor. This must be taken into account when drawing the editor on the screen:

// Called whenever SetExtent(), SetSize(), SetRect(),
// SetCornerAndSize(), or SetExtentToWholeScreen() is
// called on the control.
void CAppView::SizeChanged()
{
TRect r = Rect();
TInt scrollbarWidth = iEditor->ScrollBarFrame()->
ScrollBarBreadth(CEikScrollBar::EVertical);
TInt editorWidth = r.Width() - scrollbarWidth;
TPoint upperLeftCorner = TPoint(0, 0);
iEditor->SetExtent(upperLeftCorner, TSize(editorWidth, r.Height()));
}
124 page views in the last 30 days.
×