Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    May 2012

    Question routing and context menu

    hello im developing an application, i want to route, using nokia.maps.map.StandardMarker, but i have to use:

    to have routes working, and its fine, but, if i use those, and i use context menu, by default i have the options "zoom in, zoom out, directions from here, add a waypoint, directions to here.

    and i dont want that options by default, i want to add my own menu items to the context menu for routing.

  2. #2
    Regular Contributor
    Join Date
    Aug 2011

    Re: routing and context menu

    You need to use contextMenu.addHandler() to add your custom menu item and contextMenu.removeHandler() remove menu items passing in the function to the context menu. After some rooting around the code, I've discovered that the following will work:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    		<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    		<meta http-equiv="X-UA-Compatible" content="IE=7; IE=EmulateIE9" />
    		<title>Context Menu</title>
    		<script type="text/javascript" charset="UTF-8" src="http://api.maps.nokia.com/2.2.1/jsl.js?with=all"></script>
    		<div id="mapcanvas"  style="width:800px; height:400px;" >&nbsp;</div>
    	  <script type="text/javascript">
    // Don't forget to set your API credentials
    // Replace with your appId and token which you can obtain when you 
    // register on http://api.developer.nokia.com/ 
    			nokia.Settings.set( "appId", "YOUR APP ID GOES HERE"); 
    			nokia.Settings.set( "authenticationToken", "YOUR AUTHENTICATION TOKEN GOES HERE");
    	// Get the DOM node to which we will append the map
    		var mapContainer = document.getElementById("mapcanvas");
    		// Create a map inside the map container DOM node
    		var map = new nokia.maps.map.Display(mapContainer, {
    			components: [
    				new nokia.maps.map.component.panning.Drag(),
    				new nokia.maps.map.component.panning.Kinetic()
    			 'zoomLevel': 2,
    			  'center': [43.09, -53.674] 
    		var contextMenu = new nokia.maps.map.component.ContextMenu();
    		/* Add a Custom item */
    		var myHandler = function(contextMenuEvent, group) {
    					"Custom Item",
    						function(activationEvent) {
    							alert( "Clicked");
    		// Remove Zoom
    		// Remove  Routing
    		if (nokia.maps.routing.component !== undefined){
    	        // Add something else.

  3. #3
    Registered User
    Join Date
    May 2012

    Re: routing and context menu

    thank you! it works perfect!

Similar Threads

  1. Context Menu
    By rdnobrega in forum Symbian
    Replies: 4
    Last Post: 2009-11-23, 07:37
  2. context menu in dialog??
    By sunil304047 in forum Symbian
    Replies: 1
    Last Post: 2009-02-26, 05:23
  3. Context Menu in J2ME (LWUIT)
    By sandeepkumar03 in forum Mobile Java General
    Replies: 0
    Last Post: 2009-01-12, 09:41
  4. IAP edit in context menu
    By Gixxer2 in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2008-09-26, 14:15

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts