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
Contributor
Posts: 22
Registered: ‎01-24-2011
My Device: Not Specified

How to populate the application menu with Cascades?

The applicaiton menu that is supposed to open when clicking on the black border above the screen. Has anybody found the API to populate this menu?

Developer
Posts: 350
Registered: ‎01-21-2011
My Device: Curve 8900 (Personal) / Bold 9650 (Work)
My Carrier: Regional

Re: How to populate the application menu with Cascades?

I found two sample projects in the GitHub that implement the swipe down feature I think you are talking about. Payment Service and Good Citizen. I haven't gotten that far in my own projects, but the readme does state it uses the swipe down.

 

I also think they were designed for the PlayBook so you might have a little tweaking to do in order to use them on the Alpha, but the way they implement the Swipe Down should translate to BB10/Dev Alpha without issue.

Retired
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: How to populate the application menu with Cascades?

Check out bb::cacscades::Application::swipeDown (inherited from its superclass)

 

    /**
     * @brief This signal is emitted when the Navigator detects a swipe down gesture.
     *
     * @details Any slot attached to this signal is notified when the Navigator detects a swipe down gesture.
     * Typically the Application should display a menu in response to this gesture.
     *
     * Example usage:
     * @snippet application_swipedown.cpp Connecting to the swipeDown signal
     * @link application_swipedown.cpp
     * See full example
     * @endlink
     *
     * @ingroup Signals
     */
    void swipeDown();


Developer
Posts: 188
Registered: ‎01-27-2012
My Device: playbook
My Carrier: ...

Re: How to populate the application menu with Cascades?

listening for Qt::key_Menu works from standard Qt, I would assume it works as well for Qt::cascades?

void yourApp::keyPressEvent(QKeyEvent *event)
{
    if(event->key() == Qt::Key_Menu){
            bbMenu *men = new bbMenu(this);
            men->show();
    }
}

http://supportforums.blackberry.com/t5/Native-Development/Qt-and-Swipe-Down/m-p/1691601/highlight/tr...

Cheers,

Jon

Contributor
Posts: 22
Registered: ‎01-24-2011
My Device: Not Specified

Re: How to populate the application menu with Cascades?

How to use the swipeDown signal is clearly documented here:
https://bdsc.webapps.blackberry.com/cascades/reference/bb__Application.html

 

But an API to open a menupane seems to be missing in the 10.0.4 release. There is a broken URL to a (missing) code-example:
https://bdsc.webapps.blackberry.com/cascades/reference/application_swipedown.cpp.html

 

I tried to report the broken URL in the Issue tracker, but the issue tracker itself seem to have some issues preventing me from reporting issues.

Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: How to populate the application menu with Cascades?

Generally the event is supplied by the system, but the menu implementation is handled by your app. At least in the SDKs so far, each developer figures out how they want their menu to behave and implements it using the basic UI tools at their disposal. It's not a one-size-fits-all thing, at least for now.

Personally I'm happy it's this way, since it allows for flexibility and creativity. It shouldn't be more than a few lines of code to implement a basic menu, since you don't really need more than a rectangular area with your controls on it, and a simple animation to slide it into place when the event occurs (and even that's optional).

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!