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
Contributor
mario_n
Posts: 13
Registered: ‎05-31-2012
My Device: 9360
My Carrier: Vip
Accepted Solution

BasicEditField and Buttons focus problem

[ Edited ]

Goal:

-------------------------------------

To develop Blackberry app without focus sequence problem when using BB only with trackpad

 

 

The problem:

--------------------------------------

I have 5 BasicEditFields and 5 Buttons. All objects are aligned verticaly. When I move finger over trackpad, focus does not move from one BasicEditField to another, some are skipped over, and this also happens with Buttons, for example, when focus is on first button in row, then for some reason when I move finger over trackpad next button with focus is not the one below, but focus "jumps" to last button. Is possible to set "focus sequence order" or something like that?

 

If you have Blacberry with touch screen this is not a problem, but if you developing app for example BB Curve 9360 that has only trackpad, then you cannot select all elements.

 

 

Software used:

------------------------------------

Eclipse Indigo SDK version 3.7.2.

Blackberry Java Plug-in 1.5.0.201112201607

 

Os:

-------------------------------------

Win7, 64-bit

 

Please use plain text.
Developer
simon_hain
Posts: 16,113
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: BasicEditField and Buttons focus problem

you can overwrite moveFocus to handle focus movement yourself.
another option would be to overwrite navigationmovement.

but if your fields are just one below the other the focus order should be in the order they were added to the screen, make sure that you add them in the order you want.
----------------------------------------------------------
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.
@SimonHain on twitter
Please use plain text.
Contributor
mario_n
Posts: 13
Registered: ‎05-31-2012
My Device: 9360
My Carrier: Vip

Re: BasicEditField and Buttons focus problem

Tnx for the answer. Problem is, that some fields or buttons are added dynamicaly, so their position on the screen I guess got nothing to do with their actual index, and that is why focus changes incorrectly. This is problem if your real device has only trackpad.

Please use plain text.
Developer
simon_hain
Posts: 16,113
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: BasicEditField and Buttons focus problem

you can replace fields, or insert them at a certain index, so that should not be an issue.
----------------------------------------------------------
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.
@SimonHain on twitter
Please use plain text.
New Developer
shivam284
Posts: 108
Registered: ‎01-23-2012
My Device: torch,bold,curve,strom
My Carrier: Blackberry

Re: BasicEditField and Buttons focus problem

can you provide some sample code for this.

Thanks & Regards,
Kumar Shivam
Please use plain text.
Developer
peter_strange
Posts: 19,602
Registered: ‎07-14-2008
My Device: Not Specified

Re: BasicEditField and Buttons focus problem

Do you want sample code for inserting or replacing Fields? 

 

Isn't this simply:

<manager>.insert(...)

and

<manager>.replace(...);

Documentation in API.

 

But just to confirm Simon's point.  If you are overriding the Manager to position Fields in different places, you need to remember that by default, Managers move the focus sequentially. 

Please use plain text.
Contributor
mario_n
Posts: 13
Registered: ‎05-31-2012
My Device: 9360
My Carrier: Vip

Re: BasicEditField and Buttons focus problem

Well any help is welcome :smileyhappy:

 

Actually, I have added index to <manager>.insert, and played a little with this, and position of objects does change. But, unfortunately, focus jumps as it is before (regardles of object position), so some BasicEditField objects and Buttons can not be selected, and user can't enter anything to this field data.

 

I have also looked order of adding objects to manager, and to me it seems ok, so I guess index determines only position, but I don't understand how app decides what object is next to have focus on.

 

Again, this is not issue when all objects are added manually, but my app creates and adds buttons and other objects dynamically.

Please use plain text.
Developer
simon_hain
Posts: 16,113
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: BasicEditField and Buttons focus problem

maybe you can print the field index (getIndex() method of the field) in your debug code to check if the fields are in the order you think.

a normal manager moves the focus to the next field in the order they were added, and they are also displayed in this order.
did you overwrite navigationmovement or other related methods?
----------------------------------------------------------
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.
@SimonHain on twitter
Please use plain text.
Contributor
mario_n
Posts: 13
Registered: ‎05-31-2012
My Device: 9360
My Carrier: Vip

Re: BasicEditField and Buttons focus problem

Well, I have solution :smileyhappy:

Don't know why it is working but it does.

 

I did two things:

 

1.)

I replaced <manager>.add with insert and added Index numbers

 

2.)

Added this to code:

protected boolean navigationMovement( int dx, int dy, int status, int time ) {
return false;
}

 

I tried without step 2.) but then it focus jumps wrong, anyway, this is working now as it should.

 

 

Thank you all for your time and suggestions.

Please use plain text.