Namespaces
Variants
Actions
Revision as of 09:20, 12 October 2012 by hamishwillee (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Using SubMenu in Widget

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

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

95 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