×
Namespaces

Variants
Actions

Using read-only Editor as a disclaimer

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: symbianyucca (04 Apr 2007)
Last edited: hamishwillee (21 Dec 2011)
CEditorContainer shows basic container class for editors. This example can also be used for showing for example disclaimers by setting the editor read-only. This can be achieved by changing few lines.

First set the editor focus to EFalse which causes the cursor to disappear.

iEditor->SetFocus(EFalse);

And then change the OfferKeyEventL() method to be implemented as follows:

KeyResponse CEditorContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,
TEventCode /*aType*/)
{
TKeyResponse MyRet = EKeyWasNotConsumed;
 
 
switch (aKeyEvent.iCode)
{
case EKeyUpArrow:
if(iEditor)
{
iEditor->MoveCursorL(TCursorPosition::EFPageUp, EFalse);
iEditor->UpdateScrollBarsL();
iEditor->DrawNow();
MyRet = EKeyWasConsumed;
}
DrawNow();
break;
case EKeyDownArrow:
if(iEditor)
{
iEditor->MoveCursorL(TCursorPosition::EFPageDown,
EFalse);
iEditor->UpdateScrollBarsL();
iEditor->DrawNow();
MyRet = EKeyWasConsumed;
}
DrawNow();
break;
default:
break;
}
 
return MyRet;
}

Since the key events are not forwarded to the editor, its content can not be modified by the user and with this implementation the text is shown page-by-page when the user presses up/down arrow keys.

You can also set the editor to read only mode but the OfferKeyEventL() handling is necessary since without it the up/down keys only move the cursor up/down one line and the scrolling is not that usable.

This page was last modified on 21 December 2011, at 06:07.
25 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.

×