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

Posts: 42
Registered: ‎05-30-2012
My Device: Simulator
My Carrier: Developer
Accepted Solution

Event handling and other issues

The story is such:


I am very new to BlackBerry development. I've spent hours and hours of reading both  the native and the Cascades' documentation and I am still very confused on the possible implementation of some elements I require.


The project I am working on basically needs to create a couple of image frames and arrange them in a pattern (a possible pattern is a two by two matrix). The frames need to be arranged so that each one is resizable by dragging a custom border (the space) between two consecutive frames.

Each frame needs to load an image from a file dialog which will list images in the default directory for images. The frame ought to be able to pan and zoom (on a pinch event). This obviously can not be done using ImageView because it doesn't implement zooming or panning. I will probably need to use ForeignWindow in order to use lower (C-level) functions in order to implement zooming and panning.


However, here are the issues:


- How to handle screen touch events and/or gestures? Obviously, a button has an onClicked method in QML, but I need to know when the screen has been touched, and what control has been touched, in order to implement a resizable layout.


- How to handle the events of a ForeignWindow? The documentation only goes to saying how to create it, not how to handle its events. Regarding a Cascades app doesn't utilize a while loop to grab events, I do not understand how to handle such events?


- How do I gain lower level access to Image data? Or if it is not possible, how do I make a link between a QImage and Image to use in ImageView?


All of this has a clear solution in Native SDK, but I don't see how to incorporate the native with Cascades. Any help would be welcome.

Posts: 329
Registered: ‎05-07-2012
My Device: BB Alpha
My Carrier: N/A

Re: Event handling and other issues

Hello there, Welcome to the forums!


I will attempt to point you in the correct direction. In order to check for touch events, you can access signals from the VisualNode by following the approach discussed on this thread:




You can also have a look at our cascades API relating to Events here:



Let me know if this helps!






Posts: 42
Registered: ‎05-30-2012
My Device: Simulator
My Carrier: Developer

Re: Event handling and other issues

Thanks for the response. It does help.