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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Native Development

Reply
Contributor
mkristell
Posts: 22
Registered: ‎01-24-2011

How do I push a new View from a ContextMenu ActionItem assigned to a ListItemComponent?

I have read here https://bdsc.webapps.blackberry.com/devzone/blackberry10devalpha/ that "The Developer Relations team will be actively involved in providing developer support in the forums", so I post another question.

 

When assigning a contextmenu to a control inside a ListItemComponent, it doesn't seem possible to reference the id of the surroudning page or container from inside the ActionItem's onTriggered

 

I get this runtime error: ReferenceError: Can't find variable: navigationPane

ActionItem {
	imageSource: "asset:///images/myimage.png"
	onTriggered: {
		navigationPane.deprecatedPushQmlByString ("NextScreen.qml");
	}
}

 

 

So how can I implement this use case in QML:

1) Have a list displayed in the UI

2) Long press on an item

3) The pressed item will become selected and the context menu pops up

4) The user selects an action from the context menu that pushes the next View onto the stack

 

Please use plain text.
Developer
simon_hain
Posts: 13,820
Registered: ‎07-29-2008
My Carrier: O2 Germany

Re: How do I push a new View from a ContextMenu ActionItem assigned to a ListItemComponent?

take a look at the definition of your NavigationPane, does it have the correct id? In your case it should be navigationPane.

 

NavigationPane {
    id: navigationPane

 

 

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Contributor
mkristell
Posts: 22
Registered: ‎01-24-2011

Re: How do I push a new View from a ContextMenu ActionItem assigned to a ListItemComponent?

Yes I have the id of my NavigationPane set to navigationPane. The statement works when assigned to a Button's onClicked, but not when assigned to a ListItemComponent's onTriggered.
Please use plain text.
Developer
simon_hain
Posts: 13,820
Registered: ‎07-29-2008
My Carrier: O2 Germany

Re: How do I push a new View from a ContextMenu ActionItem assigned to a ListItemComponent?

i would suspect a bug there, seems that the visibility of the id is not correct, but if it is correctly defined in the qml that is a system-side error.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Contributor
bbkeeper
Posts: 39
Registered: ‎04-27-2010
My Carrier: VIettel

Re: How do I push a new View from a ContextMenu ActionItem assigned to a ListItemComponent?

Since it's deprecated so I suggest you not to use it. In stead, you can have other options such as attachedObjects which holds sme Pages and just push them when need.

 

attachedObjects: [
        Page {
            id: firstPage
            content: Container {
                Label {
                    text: "First attachedObjects Page"
                }
            }
            paneProperties: NavigationPaneProperties {
                backButton: ActionItem {
                    onTriggered: {
                        navigationPane.pop ();
                    }
                }
            }
        },
        Page {
            id: secondPage
            content: Container {
                Label {
                    text: "Second attachedObjects Page"
                }
            }
            paneProperties: NavigationPaneProperties {
                backButton: ActionItem {
                    onTriggered: {
                        navigationPane.pop ();
                    }
                }
            }
        }
    ]

 Or control the push and pop from C++

 

 

---
More applications/games here: http://appworld.blackberry.com/webstore/vendor/14299/
louis.keeper@gmail.com
haitt@viethop.net
http://blackberryvietnam.net
http://viethop.com
Please use plain text.