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
mstawick
Posts: 48
Registered: ‎06-24-2010
My Device: Storm 2
My Carrier: Orange

Programatically open context menu - possible?

Hi, 

 

I'd like to open context menu on button press, not on long press. Best from qml. Is this possible? I couldn't find any API calls to do this but I hope I'm just overlooking some way...

 

Michal

Please use plain text.
Developer
mstawick
Posts: 48
Registered: ‎06-24-2010
My Device: Storm 2
My Carrier: Orange

Re: Programatically open context menu - possible?

* bump * 

 

So I assume it's imossible and I'll have to create my own custom context menu. Anyone from RIM around here? 

 

Happy new year :smileyhappy:

 

Thanks

Please use plain text.
Developer
strobejb
Posts: 267
Registered: ‎10-15-2012
My Device: bb10 developer
My Carrier: Orange

Re: Programatically open context menu - possible?

Its currently not possible

 

You can use the BPS native functions to create a "system" context menu:

 

dialog_create_context_menu

 

but you are limited to system-defined icons such as cut/copy/paste etc. 

Please use plain text.
Developer
taylortbb
Posts: 137
Registered: ‎10-26-2010
My Device: Bold 9900 + PlayBook
My Carrier: Rogers

Re: Programatically open context menu - possible?

I think the question here is, why are you trying to do this? Context menus open on long press for a reason, they relate to an object the user has selected. Maybe what you need is the action menu rather than a context menu, they look almost identical but aren't tied to a selected item.

If you could explain a little bit more about what you're trying to do someone might have a better solution that more closely follows the UI guidelines.
--------
Taylor Byrnes
Please use plain text.
Developer
mstawick
Posts: 48
Registered: ‎06-24-2010
My Device: Storm 2
My Carrier: Orange

Re: Programatically open context menu - possible?

I do realize that I'm breaking some UI guidelines with my design, but sometimes you can't go by the book. Basically I have a landscape app, and I need to use whole available space. Using normal actions would make nav bar be always visible in the bottom, which takes a lot of space in landscape orientation, and also would ruin my design.

 

So what I did was place a "..." (more) button, which upon pressing presents extra options for current screen. I wanted to use context-menu facility as it comes out from right side (makes sense in landscape), and can hold actions. Perfect match for my needs, except it only works on long-press. 

 

I ended up implementing my own fake menu that slides in from right upon button press, but it would be nice if I could have utilize built-in features, even if not in their intended way.

Please use plain text.
Developer
strobejb
Posts: 267
Registered: ‎10-15-2012
My Device: bb10 developer
My Carrier: Orange

Re: Programatically open context menu - possible?

fyi - I believe it should be possible to auto-hide the actionbar, if that makes a difference to your design.

 

I know what you mean about the context-menu - I was in a similar scenario myself. I ended up implementing my own custom dialog instead (based on the SystemToast with buttons design) that prompts for user input that way. It  actually turned out pretty well, but I can see how in some circumstances it'd be nice to pop open the context menu as well

Please use plain text.
New Developer
MaxxJag
Posts: 78
Registered: ‎04-17-2011
My Device: BlackBerry Z10 LE
My Carrier: Bell

Re: Programatically open context menu - possible?

Agreed, and something I'd like to see for the browser...

MaxxWares.com
Current apps:
-BBOS 10-
MaxxTransit - Coming soon
Please use plain text.
Developer
strobejb
Posts: 267
Registered: ‎10-15-2012
My Device: bb10 developer
My Carrier: Orange

Re: Programatically open context menu - possible?

Here is the example of opening the context menu with the system-defined icons:

 

https://github.com/blackberry/Cascades-Samples/blob/master/DialogSample/src/ContextMenuDialog.cpp

 

 

Please use plain text.