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.

Display error text in WRT

From Wiki
Jump to: navigation, search

Article Metadata
Tested with
Devices(s): Nokia 5800 XpressMusic
Platform(s): S60 5th Edition
Keywords: widget.setNavigationEnabled(), device.getServiceObject(), Service.IAppManager.LaunchDoc()
Created: ivruban (28 Jan 2009)
Last edited: hamishwillee (05 Jul 2012)



This code snippet shows how to use methods Java Script for displaying error text using widget.
To obtain error used IAppManager.LaunchDoc(). Error appears because of there was not set correct value for loCriteria.Document.DocumentPath.
To use IAppManager.LaunchDoc() correctly, please see MIME type handling in WRT snippet.

To obtain access to service object for the AppManagement Service API, method getServiceObject("Service.AppManager", "IAppManager") used.

After used function IAppManager.LaunchDoc().

Source file: Relevant HTML components

<input type="button" value = "Get error" 
onclick = "getError();"></input>

Source file: JavaScript file

//Object available through a Service API. Declare service object, that is
//used to access the services.
var serviceObject = null;
window.onload = init;
// Initializes the widget
function init() {
try {
//Disabling navigation, cursor will not be shown.
//Getting service object.
serviceObject = device.getServiceObject("Service.Messaging",
} catch(exception) {
alert("exception: " + exception);
function launchDocument() {
try {
//Getting service object for application managment.
var lo = device.getServiceObject("Service.AppManager", "IAppManager");
} catch (ex) {
alert("exception: " + ex);
//Criteria for application managment's launch document function
var loCriteria = new Object();
//Object for Document memmber of criteria
loCriteria.Document = new Object();
//Opening the file in standalone application
try {
var res = lo.IAppManager.LaunchDoc(loCriteria);
document.getElementById("result").innerHTML = res.ErrorMessage;
} catch(ex){
alert("exception: " + ex);
function getError() {


Snippet shows error in text area. Click "Get error" button to apper a error.

Supplementary material

  • You can test the displaying error text in action in a simple, executable application into which this code snippet has been patched. The executables and source files are available for download at:
  • You can examine all the changes that are required to implement the above mentioned features in an application. The changes are provided in unified diff and color-coded diff formats: link_to_patchs
This page was last modified on 5 July 2012, at 02:42.
28 page views in the last 30 days.