Namespaces
Variants
Actions

Controlling the softkeys in Symbian Web Runtime

Jump to: navigation, search

This code snippet demonstrates how to show and hide the softkey pane, and how to change the right softkey caption and handler.

Article Metadata

Code Example
Tested with
Devices(s): Nokia 5800 XpressMusic, Nokia 6220 Classic

Compatibility
Platform(s): S60 5th Edition, S60 3rd Edition FP2

Article
Keywords: menu.setRightSoftkeyLabel(), menu.showSoftkeys(), menu.hideSoftkeys()
Created: dekuykin (26 Feb 2009)
Last edited: hamishwillee (04 Oct 2012)

Contents

Source file: Relevant HTML components

<input type="button" id="show" value="ENABLE SOFTKEYS" onclick="show();" />
<input type="button" id="hide" value="DISABLE SOFTKEYS" onclick="hide();" />
 
<p>Set Right Softkey Action</p>
<input type="radio" name="softkeySettings" id="softkeyExit"
onclick="setExit();" />
<label for="softkeyExit">Exit</label>
 
<input type="radio" name="softkeySettings" id="softkeyAlert"
onclick="setAlert();" />
<label for="softkeyAlert">Alert</label>

Source

/**
* Shows the softkeys.
*/

function show() {
window.menu.showSoftkeys();
}
 
/**
* Hides the softkeys.
*/

function hide() {
window.menu.hideSoftkeys();
}
 
/**
* Sets the right softkey handler and label to default.
*/

function setExit() {
window.menu.setRightSoftkeyLabel("", null);
}
 
/**
* Sets the right softkey handler and label to custom.
*/

function setAlert() {
// Call showAlert() when the softkey is pressed
window.menu.setRightSoftkeyLabel("Alert", showAlert);
}
 
/**
* Shows an alert message.
*/

function showAlert() {
alert("The right softkey was pressed!");
}

Postconditions

  • Clicking the ENABLE SOFTKEYS button makes the softkey pane visible.
  • Clicking the DISABLE SOFTKEYS button hides the softkey pane.
  • Checking the Exit radio button changes the right softkey to default handler and caption ("Exit").
  • Checking the Alert radio button changes the right softkey to custom handler and caption ("Alert").

Supplementary material

This code snippet is part of the stub concept, which means that it has been patched on top of a template application in order to be more useful to developers. The version of the WRT stub application used as a template in this snippet is v1.1.

This page was last modified on 4 October 2012, at 08:56.
215 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved