×
Namespaces

Variants
Actions
(Difference between revisions)

Adding scrollbars to a CEikRichTextEditor

From Nokia Developer Wiki
Jump to: navigation, search
Forum Nokia KB (Talk | contribs)
Forum Nokia KB (Talk | contribs)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 
__NOEDITSECTION__
 
__NOEDITSECTION__
 
+
{{KBCS}}
 
{|style="background:#eceff2" width="660px" border="1" cellpadding="5" cellspacing="0"  
 
{|style="background:#eceff2" width="660px" border="1" cellpadding="5" cellspacing="0"  
 
|-
 
|-
|'''ID''' ||  
+
|'''ID''' || CS000823
|'''Creation date''' || February 8, 2008
+
|'''Creation date''' || February 15, 2008
 
|-
 
|-
|'''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  
|'''Tested on devices''' || Nokia E90 Communicator<br />Nokia N95 8 GB
+
|'''Tested on devices''' || Nokia E90 Communicator<br>Nokia N95 8GB
 
|-
 
|-
 
|'''Category''' || Symbian C++
 
|'''Category''' || Symbian C++
Line 14: Line 14:
 
|-
 
|-
 
|'''APIs''' || None
 
|'''APIs''' || None
|'''Classes''' || CEikScrollBarFrame<br />CEikRichTextEditor
+
|'''Classes''' || CEikScrollBarFrame<br>CEikRichTextEditor
 
|-
 
|-
 
|'''Methods''' || None
 
|'''Methods''' || None
Line 22: Line 22:
 
==Overview==
 
==Overview==
  
In this code snippet, scrollbars are added to a rich text editor.
+
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 51: Line 51:
 
</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>

Revision as of 14:36, 15 February 2008


Template:KBCS

ID CS000823 Creation date February 15, 2008
Platform S60 3rd Edition
S60 3rd Edition, FP1
S60 3rd Edition, FP2
Tested on devices Nokia E90 Communicator
Nokia N95 8GB
Category Symbian C++ Subcategory UI
APIs None Classes CEikScrollBarFrame
CEikRichTextEditor
Methods None    

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()));
}
102 page views in the last 30 days.
×