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

Posts: 11
Registered: ‎03-17-2011
My Device: Storm 1
My Carrier: Verizon

How to not focus on any button.

My main screen has like five button fields.  They work fine.  When I click on them, they do what they are supposed to do.


I am testing on a Black Berry Storm 1 simulator.


However, when I click anywhere on the screen, not on a button, the button that has focus get clicked.  Is there way to stop this with without causing problems on other black berry deviced times that have a trackball that scrolls through the buttons?

Posts: 1,123
Registered: ‎02-10-2009
My Device: 8130 / 8350 / 9530 / 9550 / 9850 / PlayBook
My Carrier: Verizon

Re: How to not focus on any button.

[ Edited ]

You can override the touchevent to make sure a field is up under the touch point.

Posts: 123
Registered: ‎07-08-2011
My Device: Torch 9800, Bold 9700
My Carrier: Bell, Rogers

Re: How to not focus on any button.

I have experienced this before. Think I fixed it by ensuring the touch event is not passed to the manager where the button reside.


I think I fixed it by placing 


protected boolean navigationUnclick(int status,int time)


return true;



in the layout manager.


Berobo Inc.
Police Scanner Radio / Alarm Clock lets you listen to Police scanners in your area!
Please click the Like button to thank the user that has helped you and
please mark post as solved when you have found the solution to your problem.
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to not focus on any button.

RIM code I have seen uses the following:


    private boolean touchEventOutOfBounds( TouchEvent message )
        int x = message.getX( 1 );
        int y = message.getY( 1 );
        return ( x < 0 || y < 0 || x > getWidth() || y > getHeight() );

and ignores clicks that are out of bounds. 

Posts: 37
Registered: ‎07-26-2011
My Device: Non Blackberry User
My Carrier: Non Blackberry User

Re: How to not focus on any button.

are you using this 

public void fieldChanged(Field field, int context){
if(field==your_button_name) { ...do this.... }

if no then can try this out it may help you, i created new customButtonField class which extends Field, i used 10 buttons on a screen but not face this issue.
1. Please press the kudos button (star icon) on the left side to thank the user that helped you.
2. Please mark posts as solved if you found a solution.
- Paresh Indulkar
(Game Programmer at Synqua Games)
(Developer of games - BBM Cricket with Friends & Word Poker with Friends Smiley Very Happy )
Posts: 638
Registered: ‎07-02-2009
My Device: Not Specified

Re: How to not focus on any button.

Hi if you are writing click events, perform a check in the fieldChangeListener whether (context == ACTION_INVOKE) or not before processing the event.



Thanks and Regards,