Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
ekke
Posts: 1,595
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
My Carrier: Telekom.de, O2, Vodafone

just published: HowTo create a custom Application Menu

I just published a sample app HowTo create a custom app menu.

 

https://github.com/ekke/snippet-cascades-custom-appmenu

 

perhaps you ask: Why using a custom AppMenu ?

 

there are some possible scenarios:

 

  1. You Opened a Sheet on top of a NavigationPane or TabbedPane and this Sheet again contains a NavigationPane. If you want to use the AppMenu from this NavigationPane, it won't work, because on top of a Sheet the built-in AppMenu can't be used
  2. You are using an external Bluetooth keyboard and want to have a key for swipe-down and for the AppMenu Actions. In my sample you can use 'F10' from Bluetooth Keyboard to swipe-down and then to use other keys for the Actions.
  3. You need a specialized AppMenu with other controls then simple ActionItems: then you need a custom AppMenu. Warning: this will break BB UI Design Guidelines

 

I tried to create the custom AppMenu like the built-in. There are 2 small differences: swipe-up doesn't close and if you swipe-down on a Page with TitleBar, the TitleBar is hidden while AppMenu is opened.

 

Feel free to download the project. I will blog later in detail and make a video from my use-case in my ServiceCar app.

If you have questions about the implementation feel free to ask here.

 

have fun.

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner http://vimeo.com/ekkescorner/videos
bb10-development: http://appbus.org Twitter: @ekkescorner
Developer
slashkyle
Posts: 820
Registered: ‎10-16-2012
My Device: Red Z10

Re: just published: HowTo create a custom Application Menu

Thanks for the sample Ekke!

 

you could use this bit of code to control the menu open/close on swipe up/down I use it to open a custom menu in my app & it is fairly reliable

 

    Container {
        id: root
        
        
        onTouch: {
            if (event.isDown()) {
                downX = event.windowX;
                downY = event.windowY;
            } else if (event.isUp()) {
                if ((downY < 2)) {
                    console.log("Swipe down event should open menu");
					//Show Menu code goes here
                } else if ((downY < 1260) && (downY > 140)) {
                    console.log("Swipe up event should close menu")
					//Hide Menu code goes here
                } 
            }
        }
	}
Developer
ekke
Posts: 1,595
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
My Carrier: Telekom.de, O2, Vodafone

Re: just published: HowTo create a custom Application Menu

thx, but I didn't want to add a onTouch() on all pages only because from time to time the custom appMenu could be opened.

will add the reason to the comments in sample app

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner http://vimeo.com/ekkescorner/videos
bb10-development: http://appbus.org Twitter: @ekkescorner