Namespaces

Variants
Actions

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 over the next few weeks. Thanks for all your past and future contributions.

Revision as of 05:56, 4 October 2012 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Controlling the softkeys in Symbian Web Runtime

From Wiki
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 ExampleTested with
Devices(s): Nokia 5800 XpressMusic, Nokia 6220 Classic
Compatibility
Platform(s): S60 5th Edition, S60 3rd Edition FP2
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 05:56.
75 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×