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

Java Development

Reply
Developer
Posts: 264
Registered: ‎06-04-2009
My Device: Not Specified

Touch Screen implementation

Hi,

 

I am developing an application for blackberry torch.

 

I have buttons and list which need to be selected based on selection.

When the button or any focusable field is focused if i click on any part of the screens its accepting as a click event. Please tell me how to disable this event.

Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Touch Screen implementation

This is a consequence of the mechanics of the clkick - there is only one click switch under the display, so the focused control is going to get the click.

 

I remember having this issue - I believe that we simply checked the coordinates of the touch event when the click occurred to determine if the touch that triggered the click was actually within the region of the control.

 

Developer
Posts: 264
Registered: ‎06-04-2009
My Device: Not Specified

Re: Touch Screen implementation

Thanks for the reply

 

How to find whether click was actually within the region of the control ? using TouchEvent ?

Cna u explain with an example please ?

Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Touch Screen implementation

You should be able to get the global X,Y coordinates of the touch from the touch event, and compare this with Field.getExtent()  of the focused field - just guessing.

 

 

 

 

 

Developer
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: Touch Screen implementation


RexDoug wrote:

You should be able to get the global X,Y coordinates of the touch from the touch event, and compare this with Field.getExtent()  of the focused field - just guessing. 


In fact, you can either get the local X, Y (getX/getY) and check them to fall within (0, getWidth()) and (0, getHeight()) or get the global X and Y and compare with the results of getFieldExtent - there is a piece of code here in the forums, use 'Search' to find it.

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Highlighted
Developer
Posts: 264
Registered: ‎06-04-2009
My Device: Not Specified

Re: Touch Screen implementation

Hi 

Itrie dthis at the field level and then the problem is only the focussed icon or field is getting selected. If select another field its not getting selected. To overcome this I checked whether thetouch event is click or unclick then performed the extent check. Then when I click the bottom of the screen last item gets selected . How to overcome this ?