Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

How to add caption to a FEP-aware text editor

From Wiki
Jump to: navigation, search
Article Metadata
Tested with
Devices(s): S60
Compatibility
Platform(s): Symbian
S60 5th Edition
Article
Keywords: CEikEdwin MCoeCaptionRetrieverForFep GetCaptionForFep TCoeInputCapabilities InputCapabilities
Created: chenziteng (27 Sep 2009)
Last edited: hamishwillee (14 Sep 2012)


Contents

Overview

On S60 5th Edition Touch UI, if a text editor has caption then when the VKB is launched it can shows the caption before the text, for example in the Message Editor the VKB shows "Message:" for the message body. This article describes how to add caption to a text editor.

Solution

A new text editor class shall be created and implement the MCoeCaptionRetrieverForFep interface.

#ifndef __MYEDWIN_H__
#define __MYEDWIN_H__
 
#include <eikedwin.h> // CEikEdwin
 
class CMyEdwin : public CEikEdwin, public MCoeCaptionRetrieverForFep
{
public: // CEikEdwin
TCoeInputCapabilities InputCapabilities() const;
 
public: // MCoeCaptionRetrieverForFep
void GetCaptionForFep(TDes& aCaption) const;
};
 
#endif

The GetCaptionForFep() shall be overridden to provide the caption, and the InputCapabilities() shall be overridden to set the this pointer as the caption retriever.

#include "MyEdwin.h"
 
void CMyEdwin::GetCaptionForFep(TDes& aCaption) const
{
_LIT(KCaption, "Caption:");
aCaption = KCaption; // note: in a real world application you should check the capacity of aCaption to avoid "USER 11 Panic"
}
 
TCoeInputCapabilities CMyEdwin::InputCapabilities() const
{
TCoeInputCapabilities caps = CEikEdwin::InputCapabilities();
TCoeInputCapabilities caps2 = TCoeInputCapabilities(TCoeInputCapabilities::ENone, NULL, const_cast<CMyEdwin*>(this));
caps.MergeWith(caps2);
return caps;
}

Source Code

You can download the full example program here (the code has been verified on S60 5th Edition emulator):

HelloWorld(CaptionedEditor).zip

Screenshots

VKB for editors without and with caption.

EdwinNoCaption.PNG CaptionedEdwin.PNG

This page was last modified on 14 September 2012, at 06:40.
22 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.

×