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: 50
Registered: ‎11-15-2012
My Device: Q10
My Carrier: WIND

Dynamic InvokeQuery

I have a ListView and I'm trying to invoke the browser from onTriggered.  I want to create an Invocation with an InvokeQuery that has a uri based the user's list selection.  I tried this:

 

            onTriggered: {
               var selectedItem = dataModel.data(indexPath);
               invokeBrowser.query.uri = selectedItem.link;
               invokeBrowser.trigger("bb.action.OPEN");
            }

            attachedObjects: [
               Invocation {
                  id: invokeBrowser

                  query: InvokeQuery {
                     uri: ""
                  }
               }
            ]

But I just get: InvokeQuery: trying to set sealed property uri

 

What is the right way to do this from QML/JavaScript?

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Dynamic InvokeQuery

Can speak fro Java script, but from C++, I believe you need to set the Mime type to "html/text", and make sure you prefix the URL with http://

 

I have tried this using the invocation client you will find in the Cascades samples here:

https://developer.blackberry.com/cascades/sampleapps/

 

You could install this on the Simulator and try it out.

 

Hope this helps. 

Developer
Posts: 50
Registered: ‎11-15-2012
My Device: Q10
My Carrier: WIND

Re: Dynamic InvokeQuery

Right, but the point is that I need to be able to set the URI at all.

 

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Dynamic InvokeQuery

Sorry missed that, so you are saying this does not work?

 

invokeBrowser.query.uri = selectedItem.link;

 

I don't know QML/Javascript that well (I've only just started here) but I would have thought you would need to code this:

 

            onTriggered: {
               var selectedItem = dataModel.data(indexPath);
               invokeBrowser.invokeQuery.uri = selectedItem.link;
               invokeBrowser.trigger("bb.action.OPEN");
            }

            attachedObjects: [
               Invocation {
                  id: invokeBrowser

                  query: InvokeQuery {

                     id: invokeQuery
                     uri: ""
                  }
               }
            ]

 

Not tested!

Developer
Posts: 50
Registered: ‎11-15-2012
My Device: Q10
My Carrier: WIND

Re: Dynamic InvokeQuery

I just tried using an ID directly on the InvokeQuery, and that let me set the attribute, but that had no effect.  So I called updateQuery on it like the documentation says to do (https://developer.blackberry.com/cascades/reference/bb__cascades__invokequery.html), and then I again get:

 

InvokeQuery: trying to set sealed property uri

 

I see now, though, that the documentation at https://developer.blackberry.com/cascades/reference/bb__cascades__invocation.html says the query property becomes read only after creation...  So the question then becomes, how do I go about making a new one programatically?  I have not found a way yet.