Welcome to the Official BlackBerry® Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
tklanilkumar
Posts: 97
Registered: 02-22-2011
My Carrier: idea

TouchEvent issue

Hi all im clicking/tapping on screen. My  Screen has lot of managers which contains fields. fields having focus. Due to focus on clicking on the button particular action is getting perform. But I want if the field has the focus but Im clicking on some other area due to focus that particular button action is performing . So how to overcome this...

 

Please help me

Thanks in advance.

Please use plain text.
Developer
tommy20
Posts: 106
Registered: 05-18-2011
My Carrier: Any - Developer

Re: TouchEvent issue

Because of the bad design of this behaviour by RIM, questions like this have been asked everyday.
Please use plain text.
Developer
simon_hain
Posts: 10,780
Registered: 07-29-2008
My Carrier: O2 Germany

Re: TouchEvent issue

check if the touchevent has the same coordinates as the focused field
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.

peter_strange wrote:
"This process should happen traumatically for you in both JDE and Eclipse."
Please use plain text.
Developer
tklanilkumar
Posts: 97
Registered: 02-22-2011
My Carrier: idea

Re: TouchEvent issue

hi simon
could you pls tell how to check the coordinates...actually im checking like this....

in my customized Mybuttonfield of touchEvent() im wriiten like this..

Im adding the mybuttonfield in other screen's managers...

I dont want to peform any action on empty area of screen but due to focus of field its getting perform....




Manager m = this.getManager();
int _index = getFieldAtLocation(touchX,touchY,m);

public int getFieldAtLocation(int x, int y,Manager m)
{
XYRect rect = new XYRect();
int index = m.getFieldCount() -1;
while (index >= 0)
{
m.getField(index).getExtent(rect);
if (rect.contains(x, y))
break;
--index;
}




I think i missed on checking the coordinates... HOW TO CHECK WHETHER THE FIELD IS THERE OR NOT WHILE CLICKING ON SCREEN?
Please use plain text.
Developer
simon_hain
Posts: 10,780
Registered: 07-29-2008
My Carrier: O2 Germany

Re: TouchEvent issue

check the boundaries of the focussed field, not the one at the location.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.

peter_strange wrote:
"This process should happen traumatically for you in both JDE and Eclipse."
Please use plain text.
Developer
tklanilkumar
Posts: 97
Registered: 02-22-2011
My Carrier: idea

Re: TouchEvent issue

COULD YOU PLS HOW TELL TO CHECK THE BOUNDARIES
Please use plain text.
Developer
simon_hain
Posts: 10,780
Registered: 07-29-2008
My Carrier: O2 Germany

Re: TouchEvent issue

check your capslock key, it may be stuck.

you can use
http://www.blackberry.com/developers/docs/7.0.0api/net/rim/device/api/ui/Field.html#getContentRect()
to retrieve the space occupied by a field.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.

peter_strange wrote:
"This process should happen traumatically for you in both JDE and Eclipse."
Please use plain text.
Developer
tommy20
Posts: 106
Registered: 05-18-2011
My Carrier: Any - Developer

Re: TouchEvent issue

@tklanilkumar: As I said this question has been asked many times on this forums. Please do a search, you will find dozens of similar solutions.
Please use plain text.