(Difference between revisions)

Adding scrollbars to a CEikRichTextEditor

From Nokia Developer Wiki
Jump to: navigation, search
tanjaluodes (Talk | contribs)
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot change of template (Template:CodeSnippet) - now using Template:ArticleMetaData)
Line 2: Line 2:
|platform=S60 3rd Edition<br/>S60 3rd Edition, FP1<br/>S60 3rd Edition, FP2
|platform=S60 3rd Edition<br/>S60 3rd Edition, FP1<br/>S60 3rd Edition, FP2
Line 10: Line 10:
|creationdate=February 15, 2008
|creationdate=February 15, 2008
|keywords=CEikScrollBarFrame, CEikRichTextEditor
|keywords=CEikScrollBarFrame, CEikRichTextEditor
|sourcecode= <!-- Link to example source code (e.g. [[Media:The Code Example ZIP.zip]]) -->
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
|sdk=<!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
|devicecompatability=<!-- Compatible devices (e.g.: All* (must have GPS) ) -->
|signing=<!-- Empty or one of Self-Signed, DevCert, Manufacturer -->
|capabilities=<!-- Capabilities required (e.g. Location, NetworkServices. -->)

Revision as of 11:18, 24 June 2011


Article Metadata
Tested with
Devices(s): Nokia E90 Communicator
Nokia N95 8GB
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)
Platform Security
Capabilities: )
Keywords: CEikScrollBarFrame, CEikRichTextEditor
Created: tapiolaitinen (15 Feb 2008)
Last edited: hamishwillee (24 Jun 2011)


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)

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()->
TInt editorWidth = r.Width() - scrollbarWidth;
TPoint upperLeftCorner = TPoint(0, 0);
iEditor->SetExtent(upperLeftCorner, TSize(editorWidth, r.Height()));
132 page views in the last 30 days.