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
pskarton
Posts: 70
Registered: ‎09-06-2012
My Device: Developer
My Carrier: Bell Mobility

onTouch with ImageView does not occur for some ImageViews

First, I just find that samples run fine but as soon as I try to create a real app with QML by for instance  combining samples they just don't work.

 

onTouch is sent for some ImageViews and not others. I have systematically tried to isolate problem but cannot see any difference in code. Went back and created a separate app with an ImageView in a separate QML file and imbedded in main several of this  ImageView several times. In my test each ImageView responds to touch (click in emulator) and I know this because I rotate image. I also changed image as well.

 

Using AbsoluteLayout

 

So then I went back to my original app, copying the code that just worked (I copied QML file etc etc) into container A. 

 

But the same problem occured again with images. Only the first image still rotated, none of the other images received onTouch (I also displayed message on log). So I get two onTouches for Image at positionX and none for rest of images. (By the way had them all vertical in positionX and they worked).

 

The same ImageViews in Container B all respond to onTouch. This was original problem A except for positionX 0 do not respond. B all respond.

 

Copied one image from A to B and one Image from B to A.

 

The original B image responds as usual in Container A and the original A image does not respond in B.

 

Actual image makes no difference positionX or PositionY makes no difference. Code is same except for id/objectName and positionX & Y in each imageView.

 

changing propogation makes no difference except when none no imageViews receive on Touch. Setting progration for container A also applied to B.

 

I get message "Context: Failed to find target node with id xx" for each imageView instance but this has no effect on whether onTouch even is received.

 

Any ideas? 

Please use plain text.
Regular Contributor
pskarton
Posts: 70
Registered: ‎09-06-2012
My Device: Developer
My Carrier: Bell Mobility

Re: onTouch with ImageView does not occur for some ImageViews

Further information. I made some changes moving ImageViews out of container and everything appeared to be "now" working ok. Then, I wnet back and trued to correct slider, labels and toggle button that were not displaying porperly. And lo and behold the same issue occurred. Only now the onTouch is only sent to the last ImageView in the line. Before it was the first ImageView on the line.

 

Definitely the onTouch is not being sent to the ImageView as all ImageViews are defined with the same QML object on both lines so I know the onTouch is not being sent.

 

Has anyone experienced this problem of onTouch's not being sent or that they start stop as changes are mode to the UI?

Please use plain text.
Developer
Hithredin
Posts: 404
Registered: ‎06-03-2010
My Device: Z10 Red
My Carrier: Free

Re: onTouch with ImageView does not occur for some ImageViews

I experience also an issue with touch and imageView:

 

I catch the onTouch only if I touch the first 100px and the last px. If I touch the middle of the image, no event is fired.

Please use plain text.
Developer
djogon
Posts: 93
Registered: ‎10-29-2012
My Device: Z10
My Carrier: Various

Re: onTouch with ImageView does not occur for some ImageViews

I reported an issue where the touch events do get fired for controls that have not really been touched. For example - toucing to the left of the control will trigger onTouch event with negative X coordinate. I wonder if this has something to do with that. 

 

Other than that - take a look at TouchPropagationMode. This will allow you to control how the touch is propagated if you have controls that sit on top of each other.

bb::cascades::TouchPropagationMode

 

It is possible that some other transparent object is covering your imageView as well.

 

Please use plain text.
Developer
theappspod
Posts: 122
Registered: ‎11-12-2010
My Device: Dev Alpha
My Carrier: N/A

Re: onTouch with ImageView does not occur for some ImageViews

Hello

 

I have a similar problem. I have a series of imagebuttons and have a container with an absolute layout which is used to position text on the imagebuttons.  The problem is that none of the buttons now respond to taps. If I remove the container with absolute layout, it works fine.

 

I have tried setting TouchPropagationMode for the container but no joy.  Can you please help?

Please use plain text.
Regular Contributor
pskarton
Posts: 70
Registered: ‎09-06-2012
My Device: Developer
My Carrier: Bell Mobility

Re: onTouch with ImageView does not occur for some ImageViews

First, I gave up on any layout but absolute because the others were unpredictable. I lost flexibility but could make sure layout was as I wanted.

 

Then, I gave up on ImageButtons in those containers. They work else where.

 

I use ImageView with onTouch  with  if (event.isDown) to respond.

 

I have currentImage,  defaultImage, pressedImage, and disabledImage  file for each for each one which.

 

In some cases, I took a screen dump with the buttons before I replaced them and cut the ImageButton and turned it into its own png file in paint.Net.

 

A little bit or work but not impossible - took me half a day to create images and program and haven't had a problem since. Of course, I have not tested with the "Gold" version yet

Please use plain text.
Developer
Dredvard
Posts: 160
Registered: ‎01-27-2012
My Device: Playbook
My Carrier: Rogers

Re: onTouch with ImageView does not occur for some ImageViews

I ran into the  issues with docked overlapped images not passing onTouches along.  They only solution I found was to use TapHandlers (Gesture Handler) to capture the presses.

---
If you find my post helpful please "like" it and "accept as a solution"
Please use plain text.
Developer
Dredvard
Posts: 160
Registered: ‎01-27-2012
My Device: Playbook
My Carrier: Rogers

Re: onTouch with ImageView does not occur for some ImageViews

I've been able to repoduce this bug in a lot of circumstances - and it has some annoying effects - like not letting cotext handlers function.

 

You can vote or watch this issue here.

 

https://www.blackberry.com/jira/browse/BBTEN-484

---
If you find my post helpful please "like" it and "accept as a solution"
Please use plain text.