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
Regular Contributor
Guillaume_LACHAUD
Posts: 60
Registered: ‎12-19-2012
My Device: BB10 Alpha B
My Carrier: SFR
Accepted Solution

Invocation from QML

[ Edited ]

Hi !

 

I have read a lot of posts on Invocation trough QML. A lot of issues seems related to a dynamic invocation. But even when the url is set in the code I cannot manage to get it working. here is my code :

 

 ImageView {
        id: actualAd
        objectName: "actualAd"
        image: adLoader.image
        horizontalAlignment: HorizontalAlignment.Fill
        verticalAlignment: VerticalAlignment.Fill
        scalingMethod: ScalingMethod.Fill
        onImageChanged: {
            fade.play();
        }
        gestureHandlers: [
            TapHandler {
                onTapped: {
                    invokeAdLink.trigger("bb.action.OPEN");
                }
            }
        ]
        attachedObjects: [
            Invocation {
                id: invokeAdLink
                query: {
                    uri:
                    "http://www.google.fr"
                    invokeTargetId:
                    "sys.browser"
                }
            }
        ]
    }

 

 

When I click on the Image, nothing happens. Any idea ?

Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Invocation from QML

It's a bit hard to read since you didn't use the code formatting feature (little "C" icon in the editor), but try without the colon after "query". Just do "query { uri: ... }" and see if that helps.

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!
Please use plain text.
Regular Contributor
Guillaume_LACHAUD
Posts: 60
Registered: ‎12-19-2012
My Device: BB10 Alpha B
My Carrier: SFR

Re: Invocation from QML

I have indeed seen the two version, with and without the semicolon depending on which article of the documentation you read.

 

When I remove it, the editor gets all mad... but it works ! Thanks

Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Invocation from QML

With the colon, syntactically it's an attempt to reassign the value, and that won't work with a read-only property. Without the colon, it's just updating the properties *of* that query object. Same thing as if you individually assigned them by saying [query.uri: 'foo'] and [query.invokeTargetId: 'bar'].

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!
Please use plain text.