You Are Here:

Community: Wiki

This page was last modified on 23 June 2009, at 11:21.

TSS001439 - Retrieving the content of RichTextEditor at the tapped position on 5th Edition devices

From Forum Nokia Wiki



ID TSS001439 Creation date June 23, 2009
Platform S60 5th Edition Devices Nokia 5800 XpressMusic
Category Symbian C++ Subcategory UI


Keywords (APIs, classes, methods, functions): HandlePointerEventL, CEikRichTextEditor

Overview

This article explains how to retrieve the content of RichTextEditor at the tapped position.

Description

As S60 5th Edition devices are touch sensitive, the pointer events can be captured using HandlePointerEventL(). This is also used to handle such events as pointer down/up and dragging. Thus a class derived from CCoeControl can implement the HandlePointerEventL() function for customising the handling of pointer events.


In order to get the contents of the Editor, first we need to get the co-ordinates of the tapped event and then identify the document position of the nearest character edge to the window coordinates specified. This helps in retrieving the content (entire word) nearest to the tapped position.

Solution

Headers Required

#include <FRMTVIEW.H> 
#include <TXTRICH.H>

Libraries

LIBRARY    etext.lib
LIBRARY form.lib

The following code snippet enables the retrieving of the contents of the editor at the tapped position. This has to be used in HandlePointerEentL().

TPoint tapPoint( aPointerEvent.iPosition );
//iEditor is a CEikRichTextEditor object
CTextView* iTextView = iEditor->TextView();
//Get the current document position based on the point where the stylus is tapped.
TInt docPos(iTextView->XyPosToDocPosL( tapPoint ) );
TInt start( 0 );
TInt length( 0 );
//By passing the current position of the document you can get the word information
//(the start position and the length)
iEditor->RichText()->GetWordInfo(docPos,start,length, EFalse, EFalse);
if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
{
// Based on the start position and the length get the word information.
// using the method Mid(TInt aPos, TInt aLength) const;
// the word at the tapped position can also be modifed
}


The above code snippet can also be used for highlighted items like URLs, phone numbers, and HTTP addresses. The Item Finder API can be used for highlighting URLs, phone numbers, and HTTP addresses.


In order to identify whether the stylus is tapped on the tag or not, the method CursorOverTag() can be used. The method returns a boolean value besides giving the start position and the length of the tag.

TBool iFlag = iEditor->RichText()->CursorOverTag( docPos, parser, start, length );

Related Links

For information on the Item Finder API, see the following link: [1]

Related Wiki Articles

No related wiki articles found

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZdescriptionQSxEa0E20WikiE20javaE20symbianE5fosE20s60E20maemoE20cE2bE2bE20WikiE20HomeE20WikiE20HelpE20OverviewE20GlossaryE20CreateE20PageE20ProposeE20anE20ArticleE20SpotlightE20TopicE20E2dE20WE52TE20WidgetsE20ProgrammingE20E4canguageE20E2dE20SymbianE20CE2bE2bE20E2dE20OpenE20CE2fCE2bE2bE20E2dE20JavaE20E2dE20FlashE20E4citeE20E2dE20PythonE20WebE20TechnologiesE20E2dE20WE52TE20WidgetsE20E2dE20WidSetsE20ToolsE20andE20SE44KE20CodeE20E45E78amplesE20KnowledgeE20BaseE20TechnologyE20AreasE20SoftwareE20PlatformsE20E44evelopmentE20ProcessE20E3fE3fWikiE20ChineseE20E3fE3fE3fWikiE20JapaneseE20PortugueseE2fBrazilianE20E52ussianE20WhatE20linksE20hereE20UploadE20fileE20SpecialE20pagesE20PrintableE20versionE44ownloadE20asE20PE44FE20GoE20ToE20E2eE2eE2eX qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fTSS000709E5fE2dE5fManagingE5fVoIPE5fprofilesX qdcZpublisherQUxhttpE3aE2fE2fswE2enokiaE2ecomE2fidE2fc764fd1cE2d8b06E2d499aE2d9a6aE2d17c3903d5a65E2fforumE5fnokiaE5fcrawlerE5fagentX qdcZtitleQSxTSS000709E20E2dE20ManagingE20VoIPE20profilesE20E2dE20ForumE20NokiaE20WikiX qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qrssZdescriptionQSxEa0E20WikiE20javaE20symbianE5fosE20s60E20maemoE20cE2bE2bE20WikiE20HomeE20WikiE20HelpE20OverviewE20GlossaryE20CreateE20PageE20ProposeE20anE20ArticleE20SpotlightE20TopicE20E2dE20WE52TE20WidgetsE20ProgrammingE20E4canguageE20E2dE20SymbianE20CE2bE2bE20E2dE20OpenE20CE2fCE2bE2bE20E2dE20JavaE20E2dE20FlashE20E4citeE20E2dE20PythonE20WebE20TechnologiesE20E2dE20WE52TE20WidgetsE20E2dE20WidSetsE20ToolsE20andE20SE44KE20CodeE20E45E78amplesE20KnowledgeE20BaseE20TechnologyE20AreasE20SoftwareE20PlatformsE20E44evelopmentE20ProcessE20E3fE3fWikiE20ChineseE20E3fE3fE3fWikiE20JapaneseE20PortugueseE2fBrazilianE20E52ussianE20WhatE20linksE20hereE20UploadE20fileE20SpecialE20pagesE20PrintableE20versionE44ownloadE20asE20PE44FE20GoE20ToE20E2eE2eE2eX qfnZdistributionQUxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2fX qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZupdatedQDx2008E2d10E2d02X qfnZuserE5ftagQSxpluginX qmarsZdescriptionQSxEa0E20WikiE20javaE20symbianE5fosE20s60E20maemoE20cE2bE2bE20WikiE20HomeE20WikiE20HelpE20OverviewE20GlossaryE20CreateE20PageE20ProposeE20anE20ArticleE20SpotlightE20TopicE20E2dE20WE52TE20WidgetsE20ProgrammingE20E4canguageE20E2dE20SymbianE20CE2bE2bE20E2dE20OpenE20CE2fCE2bE2bE20E2dE20JavaE20E2dE20FlashE20E4citeE20E2dE20PythonE20WebE20TechnologiesE20E2dE20WE52TE20WidgetsE20E2dE20WidSetsE20ToolsE20andE20SE44KE20CodeE20E45E78amplesE20KnowledgeE20BaseE20TechnologyE20AreasE20SoftwareE20PlatformsE20E44evelopmentE20ProcessE20E3fE3fWikiE20ChineseE20E3fE3fE3fWikiE20JapaneseE20PortugueseE2fBrazilianE20E52ussianE20WhatE20linksE20hereE20UploadE20fileE20SpecialE20pagesE20PrintableE20versionE44ownloadE20asE20PE44FE20GoE20ToE20E2eE2eE2eX qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ