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: 826
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

how to use action items with no context menu

[ Edited ]

how can i go from using this (works as a context action)

 

InvokeActionItem  {
                                    title: "Share Message"
                                    id: shareInvoke
                                    query {
                                        mimeType: "text/plain"
                                        data: application.getByteArray(myTextArea.text);
                                        invokeActionId: "bb.action.SHARE"
                                     }
                                     onTriggered: {
                                         data = myTextArea.text;
                                     }
                                 }

 to something that will work without a context action menu, action menu, any default menu....

 

I got this below to populate the share menu, howver the text is not transferred like it was with the invoke action item

 

Button {
            text: "Settings"
            attachedObjects: [

                       Invocation {
                           id: invoke
                           query: InvokeQuery {
                               mimeType: "text/plain"
                               data: application.getByteArray(myTextArea.text)
                           }
                       }
                   ]

                   onClicked: {
                      
                       invoke.trigger("bb.action.SHARE")
                   }
               }

 If possible i would still like to avoid  C++ methods

 

... I had to create my own menu in order to instantly open it instead of the delay that context actions have, It's working great however the most important option doesnt Smiley Sad

Highlighted
Developer
Posts: 91
Registered: ‎09-25-2012
My Device: bb10 alpha
My Carrier: free

Re: how to use action items with no context menu

Use : updateQuery () in Invocation : 

 

onQueryChanged : updateQuery ()

a lover of Qt
Developer
Posts: 826
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: how to use action items with no context menu

that worked amazingly well, & I would have never though of it.... Thanks a million Smiley Very Happy

Developer
Posts: 826
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: how to use action items with no context menu

for some reason i cant get it to transfer the text without calling trigger("bb.action.SHARE") in the onArmed: signal

 

Button {                  
attachedObjects: [ Invocation { id: invoke query: InvokeQuery { id: invokeQuery mimeType: "text/plain" } onArmed: { invoke.trigger("bb.action.SHARE"); } } ] onClicked:{ invokeQuery.data = myTextArea.text; invokeQuery.updateQuery(); }
}

 the only issue with this is it pops up the share screen as soon as the app opens

 

                    onClicked:{
                        invoke.trigger("bb.action.SHARE");
                        invokeQuery.data = myTextArea.text;
                        invokeQuery.updateQuery();
                        }

 removing on armed & placing invoke inside onClicked causes the app to freeze & crash. but if i remove any reference to updateQuery() it will bring up the target  list, only it does not carry the data from my text area

Developer
Posts: 826
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: how to use action items with no context menu

[ Edited ]

it was allowing me to use it 

 

Button {
    attachedObjects: [
        Invocation
        {
            id: invoke
            query: InvokeQuery
            {
                id: invokeQuery
                invokeActionId: "bb.action.SHARE"
                mimeType: "text/plain"
                onQueryChanged: updateQuery()
data: appName.getByteArray(myTextArea.text) } } ] onClicked: { invoke.trigger("bb.action.SHARE") } }

 but for some reason it won't allow me to use it without calling onArmed & it launching with my app if i delay on armed by placing it inside onClicked

 

onClicked: {
invoke.onArmed = invoke.trigger("bb.action.SHARE");
}

 it delays the launch until clicked however it will not transfer or update the text from my text area