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
Highlighted
New Developer
Posts: 11
Registered: ‎01-17-2013
My Device: BlackBerry Z10
My Carrier: Bell

Is there a way to activate a control's contextActions through javascript in qml (manually open context menu)

I have a context menu on a Label control, but I also want to have a button beside the label which executes the Label controls contextActions (open the context menu for the Label control).  I find the press-and-hold is hard for users to discover at first and by having a button which opens the context menu on click, that makes the app more usable.

Andrew Forget
BlackBerry Z10
Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: Is there a way to activate a control's contextActions through javascript in qml (manually open context menu)

[ Edited ]

Hi,

 

There's an excellent sample on github - DialogSample. You'll need ContextMenuDialog.cpp / .hpp files from it.

https://github.com/blackberry/Cascades-Samples/tree/master/DialogSample/src

It already has bindings for qml. Check main.qml for sample usage.


Andrey Fidrya, @zmeyc on twitter
New Developer
Posts: 11
Registered: ‎01-17-2013
My Device: BlackBerry Z10
My Carrier: Bell

Re: Is there a way to activate a control's contextActions through javascript in qml (manually open context menu)

This is very close, but it's not the system context menu, it uses a facsimile. It's a very cool sample and I will definitely think about trying this, but I was looking for something that would open the system context menu for a given control.

Thanks!
Andrew Forget
BlackBerry Z10