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. Thanks for all your past and future contributions.

Archived:Scrolling through messages and views in custom MTM

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

Article Metadata
Platform(s): S60 3rd Edition, all FPs
S60 3rd Edition (initial release)
Created: User:Technical writer 1 (08 Sep 2008)
Last edited: hamishwillee (14 Jun 2012)



While viewing SMS messages, the current message number and the total number of messages in the inbox is displayed on the navigation pane as (x/y). By pressing the right/left arrow keys, the next/previous message is displayed. Finally, when exiting the message viewer and returning to the inbox, the last viewed message is highlighted.

The following code snippet can be used to implement the same feature for a custom MTM.


The above procedure works as follows:

From the Message Centre (MCE, which handles the exit code and updating the focus to next message and opening the next message) point of view, the basic flow of the above procedure is as follows.

1. The user selects 'Open' for a message.
2. MCE calls the CBaseMtmUi::OpenL(status) of the corresponding MTM. This is an asynchronous operation.
3. MTM shows the message.
4. The user presses left or right.
5. The viewer is closed and the asynchronous operation is completed. MTM has an option to set the operation status (variable given to OpenL()) to two special values: EMsgExitNext or EMsgExitPrevious(see the below code).
6. If either special value is used, the MCE moves the focus in the message list accordingly and opens the next/previous message in the same way as in step 2.

Header files

 #include <apparc.h>  // MApaEmbeddedDocObserver

Example code

The following code is used to send the "Next Message" exit code from the viewer:

 enum TMsgExitMode
EMsgExitNext = 42,
EMsgExitPrevious = 43,
EMsgExternalExit = 44
// In HandleKeyEventL() function of the viewer application, pass
// the corresponding exit code for the corresponding key events.
CEikonEnv* env = CEikonEnv::Static();
CEikAppServer* server = env->AppServer();
if ( server )
server->NotifyServerExit( EMsgExitNext );

Similarly, use EMsgExitPrevious to move to the previous message.

In order to notify MCE about the exit code, implement HandleServerAppExit() (inherited from MAknServerAppExitObserver) as follows:

   TInt exitMode = aReason;
TRequestStatus* stat = &iStatus;
User::RequestComplete( stat, exitMode );
MAknServerAppExitObserver::HandleServerAppExit( aReason );
This page was last modified on 14 June 2012, at 07:53.
51 page views in the last 30 days.