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 06:20, 12 October 2012 by hamishwillee (Talk | contribs)

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

Using SubMenu in Widget

From Wiki
Jump to: navigation, search

This code snippet shows how the submenu can be used in Symbian Web Runtime.

Article Metadata
Tested with
Devices(s): Nokia N96
Compatibility
Platform(s): S60 3rd FP2,S60 5th Edition
Symbian
S60 5th Edition
S60 3rd Edition FP2
Article
Keywords: submenu
Created: ck.umraliya (06 Jan 2009)
Last edited: hamishwillee (12 Oct 2012)

Source file: index.html

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript" src="basic.js"></script>
<script type="text/javascript" src="WRTKit/WRTKit.js"></script>
<style type="text/css">
@import url("basic.css");
</style>
</head>
<body onload="makemenu()">
</body>
</html>

Javascript File

//Creating Menu Id's
OP1 = 100
OP2 = 101;
OP3 = 102;
OP4 = 103;
OP5 = 104;
 
// Function which creates option menu
function makemenu()
{
// Create a Menu item
m1 = new MenuItem('MenuOptions1', OP1);
 
// Append Menu item to option Menu
window.menu.append(m1);
 
// Create three more Menu items for Sub-Menu
m11 = new MenuItem("option1", OP3);
//assign select handlings
m11.onSelect = onsubMenuSelect;
//append to menu
m1.append(m11)
 
m12 = new MenuItem("option2", OP4);
m12.onSelect = onsubMenuSelect;
m1.append(m12)
 
m13 = new MenuItem("option3", OP5);
m13.onSelect = onsubMenuSelect;
m1.append(m13)
 
// function that handles select operation of submenu items
function onsubMenuSelect(id)
{
switch (id)
{
case OP3:
//do something
break;
case OP4:
// do something
break;
case OP5:
// do something
break;
}
}

Postconditions

Submenu.jpg

This page was last modified on 12 October 2012, at 06:20.
53 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.

×