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
Posts: 193
Registered: ‎12-29-2010
My Device: Bold 9900
My Carrier: Rogers

Positioning of actions in the overflow menu

I'm trying to position action items in different places on the overflow menu (the three vertical dots).

 

According to this page (http://docs.blackberry.com/en/developers/deliverables/41577/action_bars.jsp), actions such as "Delete", should included  at the bottom of an action overflow menu. The link above even has a visual of how to do it.

 

I can't seem to find a way to do this however. All my action items are listed from the top of the screen, down vertically. How can I isolate one, and move it down to the bottom of the overflow menu list.

 

I tried adding empty ActionItem{}, but that creates the separation bar as well as the gear icon. My code is basic so far, so here it is:

 

actions: [
                //-- define the actions for first tab 
                ActionItem {
                    title: qsTr("Sort A-Z")
                    onTriggered: {
                        titletwo.text = "Sort A-Z"
                    }
                },
                ActionItem {
                    title: qsTr("Sort Z-A")
                    onTriggered: {
                        titletwo.text = "Sort Z-A"
                    }
                },
                ActionItem {
                    title: qsTr("Sort by Area")
                    onTriggered: {
                        titletwo.text = "Sort by Area"
                    }
                }
            ]

 

Thanks.

 

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

Re: Positioning of actions in the overflow menu

Looks like the docs are a bit weak in this area, but I found a sample that answers part of it: https://github.com/blackberry/Cascades-Samples/blob/master/bucketlist/assets/main.qml

 

Note the use of "deleteAction: DeleteActionItem {...}" in there. 

 

The DeleteActionItem is documented, and perhaps just including it in the list will make it appear automatically in the right place.  Otherwise using the above property name will apparently do the job.


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!
Developer
Posts: 193
Registered: ‎12-29-2010
My Device: Bold 9900
My Carrier: Rogers

Re: Positioning of actions in the overflow menu

@peter9477

 

Thanks for the reply.

However the code you've mentioned only shows up well in the contextual menu. (The menu which is shown by pressing and holding an item).

 

It still shows up sequentially after the other items in the Action overflow menu (accessed by the three vertical dots). Still nothing like the link I mentioned (http://docs.blackberry.com/en/developers/deliverables/41577/action_bars.jsp)

Retired
Posts: 155
Registered: ‎07-16-2012
My Device: Dev Alpha
My Carrier: Bell

Re: Positioning of actions in the overflow menu

Hi gpatton,

 

did you have a look at quotes sample? https://github.com/blackberry/Cascades-Samples/tree/master/quotes

 

Hope this helps.

Retired
Posts: 155
Registered: ‎07-16-2012
My Device: Dev Alpha
My Carrier: Bell

Re: Positioning of actions in the overflow menu

Hi gpatton,

 

did you have any luck with that?

 

Cheers,

New Contributor
Posts: 4
Registered: ‎01-20-2011
My Device: Q10
My Carrier: AT&T

Re: Positioning of actions in the overflow menu

Just wondering if there has been a solution for this yet?

Developer
Posts: 54
Registered: ‎05-14-2013
My Device: LE Z10
My Carrier: Ben(T-Mobile network)

Re: Positioning of actions in the overflow menu

Instead of using ActionItem {}
Use
DeleteActionItem {}

 

        ActionItem {
            title: "Action 1"
            ActionBar.placement: ActionBarPlacement.OnBar
            imageSource: "asset:///icons/ic_edit.png"
            onTriggered: {

            }
        },
        DeleteActionItem {
            title: "Delete"
            onTriggered: {
               
            }
        },

 

Don't forget to mark as solved and like my post if it helped out!