×
Namespaces

Variants
Actions

Adding scrollbars to a CEikRichTextEditor

From Nokia Developer Wiki
Jump to: navigation, search
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: hamishwillee (03 Jun 2013)

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()));
}
This page was last modified on 3 June 2013, at 02:23.
103 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×