Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9143] BlackBerry: Implement BB Application Menu (Crosscut Menu)

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2013-09-27T19:50:29.000+0000
Affected Version/sn/a
Fix Version/s2013 Sprint 20, 2013 Sprint 20 API, Release 3.2.0
ComponentsBlackBerry
Labelsqe-closed-3.2.0, qe-testadded, small
ReporterJosh Roesslein
AssigneePedro Enrique
Created2012-05-16T07:25:22.000+0000
Updated2013-12-18T23:47:10.000+0000

Description

On BB10 devices swiping from the top of the screen will display a menu bar of action items it is used to control not often use actions that apply (crosscut) across the entire app. See https://developer.blackberry.com/cascades/reference/bb__Application.html#function-swipedown https://developer.blackberry.com/cascades/documentation/ui/navigation/menus.html Look at NativeWindowObject.cpp to see how to do ActionItems

Comments

  1. Pedro Enrique 2013-09-27

    The following is the Titanium API for the Application Menu:
       // Creates the menu with the three options
       var appMenu = Ti.UI.BlackBerry.createApplicationMenu({
       	items: [
       		{title: 'one'},
       		{title: 'two', icon: '/images/appcelerator_small.png'},
       		{title: 'three'}
       	]
       });
       
       appMenu.addEventListener('click', function(e) {
       	// use the e.index to the the menu item index
       });
       
       // Add another item:
       appMenu.addItem({ title: 'meh', icon: 'some_image.png' });
       
       // Remove an item
       appMenu.removeItem( 1 ); // Index number
       
       // Remove all items:
       appMenu.removeAllItems();
       
    Node: this creates a global menu for the entire app For information on limitations, please look here: http://developer.blackberry.com/native/documentation/cascades/ui/navigation/menus.html
  2. Pedro Enrique 2013-09-27

    PR: https://github.com/appcelerator/titanium_mobile_blackberry/pull/179
  3. Olga Romero 2013-12-10

    need more info
  4. Pedro Enrique 2013-12-10

    Paste this code in app.js
       var win = Ti.UI.createWindow();
       win.open(); 
       
       // Creates the menu with the three options
       var appMenu = Ti.UI.BlackBerry.createApplicationMenu({
           items: [
               {title: 'one'},
               {title: 'two', icon: '/images/appcelerator_small.png'},
               {title: 'three'}
           ]
       });
        
       appMenu.addEventListener('click', function(e) {
           // use the e.index to the the menu item index
       });
        
       // Add another item:
       appMenu.addItem({ title: 'meh', icon: 'some_image.png' });
       
    and run it. Once the app is running, slide your finger from the top of the phone down. As if you were dragging the status bar.
  5. Pedro Enrique 2013-12-10

    A side note, you need at least one window open. For testing, place this on app.js at the very top:
       var win = Ti.UI.createWindow();
       win.open();
       
  6. Olga Romero 2013-12-10

    Tested the above code with: Appcelerator Studio, build: 3.2.0.201312091648 Titanium SDK, build: 3.2.0.v20131209192649 CLI 3.2.0-cr Alloy 1.3.0-cr BlackBerry Z10 10.1.0.2019

JSON Source