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
Contributor
sam-truscott
Posts: 12
Registered: ‎04-23-2013
My Device: Z30
Accepted Solution

postEvent to ImageButton not working

(continued from http://supportforums.blackberry.com/t5/Cascades-Development/Automated-Integration-Testing/m-p/232630...)

 

I've managed to record TouchEvents (their screen x/y, window x/y, local x/y) and their receiver and target objects. However, when I try and create a new TouchEvent and post it back to the receiver I get a Message Handler warning of:

 

Trying to send event unknown receiver: "Event[Touch] Time[08:53:30:841] Phase[142743258] Type[0] Screen[149,176] Window[149,176] Local[149,176]" 

 using the code:

...
TouchEvent * te = new TouchEvent(TouchType::Type(touchType), sx, sy, wx, wy, lx, ly, visualObject);
QCoreApplication::postEvent(receiverObject, te);
...

 I have tried all combinations of posting - posting to the Application (bb::cascades), posting to the scene, posting to the receiver and the target itself but I always get the same error.

 

What am I missing to inject touch events?

Please use plain text.
Contributor
sam-truscott
Posts: 12
Registered: ‎04-23-2013
My Device: Z30

Re: postEvent to ImageButton not working

Is this related to http://www.qtcentre.org/threads/17696-postEvent-and-multithreading? Do events need to originate from the same event queue thread?
Please use plain text.
Contributor
sam-truscott
Posts: 12
Registered: ‎04-23-2013
My Device: Z30

Re: postEvent to ImageButton not working

I've done this and no change - however I have noticed that the Phase (I assume this is the Propogation Phase) is just a crazy value - yet it isn't on the constructor list and I can't see a way to initialise it to a sensible value.
Please use plain text.
Contributor
sam-truscott
Posts: 12
Registered: ‎04-23-2013
My Device: Z30

Re: postEvent to ImageButton not working

QMetaObject::invokeMethod(visualObject, "touch", Q_ARG(bb::cascades::TouchEvent*,te));

 This essentially fires the touch event straight to the object (ignoring the receiver for now - I might try and hook that up) but right now the propogation of using postEvent (i.e. the proper way that seems to work on QT4 with Hooq etc) doesn't seem to work with Cascades.

Please use plain text.