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
eicheled
Posts: 77
Registered: ‎04-01-2011
My Device: Bold 9700
Accepted Solution

Yet another question about focus with tab panes

 

I'm quite new to this, but I have been scouring the boards and trying many different things, and I've decided to seek advice.

 

There are other threads similar to my problem such as :

 

http://supportforums.blackberry.com/t5/Java-Development/SetFocus-Issue-with-Tabbed-Screen-Page/m-p/6...

 

http://supportforums.blackberry.com/t5/Java-Development/How-to-delete-a-Manager-or-a-Field-that-is-c...

 

I have a tabbed pane set up based on the example and all works well until I delete a row from a VerticalFieldManager. It defaults the focus to the first item on the screen, and I get that. My problem is trying to override/replace that behavior.

 

My MainScreen implements the FocusChangeListener for the tab buttons (custom LabelFields).

 

I've tried many different variations - I've tried to manage the focus totally manually and ended up with a bit of a mess. I've tried catching the navigationUnclick() event and coding the focusChanged() method to manually switch the focus, but it seems that the focusChanged() method gets called before the focusChanged(), which doesn't help me.

 

As I said I'm fairly new to this so I could be doing something very stupid, but I don't really understand the focus handling implementation. A kick in the right direction would be appreciated.

 

Thanks.

 

 

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

Re: Yet another question about focus with tab panes

You might want to have a NullField in your Managers before all other fields - this way, even if you delete the rest, the NullField might retain the focus.

If it doesn't help, try also overriding sublayout for your managers, call super.sublayout and then explicitly setFocus to your NullField (any field deletion causes a displayed Manager to re-layout).

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Developer
eicheled
Posts: 77
Registered: ‎04-01-2011
My Device: Bold 9700

Re: Yet another question about focus with tab panes

 

I tried inserting a NullField and it worked like a charm. It's a nice simple solution. Thank you arkadyz.