×
Namespaces

Variants
Actions
(Difference between revisions)

Display error text in WRT

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot change of template (Template:CodeSnippet) - now using Template:ArticleMetaData)
hamishwillee (Talk | contribs)
m (Hamishwillee - Fix categories)
 
Line 1: Line 1:
__NOTOC__
+
[[Category:Symbian Web Runtime]][[Category:Code Examples]][[Category:Debugging]]
__NOEDITSECTION__
+
 
 
{{ArticleMetaData
 
{{ArticleMetaData
 
|id= 
 
|id= 
Line 15: Line 15:
 
|devicecompatability=<!-- Compatible devices (e.g.: All* (must have GPS) ) -->
 
|devicecompatability=<!-- Compatible devices (e.g.: All* (must have GPS) ) -->
 
|signing=<!-- Empty or one of Self-Signed, DevCert, Manufacturer -->
 
|signing=<!-- Empty or one of Self-Signed, DevCert, Manufacturer -->
|capabilities=<!-- Capabilities required (e.g. Location, NetworkServices. -->)
+
|capabilities=<!-- Capabilities required (e.g. Location, NetworkServices. -->
 
|author=[[User:Ivruban]]
 
|author=[[User:Ivruban]]
 
}}
 
}}
Line 96: Line 96:
  
 
* 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]]
 
* 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]]
 
[[Category:Symbian Web Runtime]][[Category:Code Examples]]
 

Latest revision as of 05:42, 5 July 2012


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


Contents

[edit] Overview

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().

[edit] Source file: Relevant HTML components

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

[edit] 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.
widget.setNavigationEnabled(false);
//Getting service object.
serviceObject = device.getServiceObject("Service.Messaging",
"IMessaging");
} 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() {
launchDocument();
}

[edit] Postconditions

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

[edit] 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: Media:DisplayErrorText.zip.
  • 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 05:42.
43 page views in the last 30 days.