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: 125
Registered: ‎08-11-2011
My Device: Blackberry Smartphone 9780
My Carrier: -
Accepted Solution

EditField + HFM (HScroll) + NextFocus issue

Hi , i have a EditField inside a HorizontalFieldManager with Horizonta_scroll, and in the right of the manager there is a button, well, the problem is when i want to change the focus, from editfield to the button, because the editfield is continuously moving to the right side and the button cant get the focus

 

There is a solution for thaht? Thanks.

 

PD:

 

HorizontalFieldManager is width and height fixed.

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

My good english is beceause i dont speak english
Developer
Posts: 16,842
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: EditField + HFM (HScroll) + NextFocus issue

doesn't the focus move to the right if you scroll down?
----------------------------------------------------------
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
Developer
Posts: 125
Registered: ‎08-11-2011
My Device: Blackberry Smartphone 9780
My Carrier: -

Re: EditField + HFM (HScroll) + NextFocus issue

[ Edited ]

There is a list in the second row

 

ROW 1 :

 

EditField  - Button

 

ROW 2 :

 

ListField

 

If i scroll down, the next focus of the editfield is the listifeld

 

I have all the controls inside an absolutefieldmanager.

 

:

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

My good english is beceause i dont speak english
Developer
Posts: 125
Registered: ‎08-11-2011
My Device: Blackberry Smartphone 9780
My Carrier: -

Re: EditField + HFM (HScroll) + NextFocus issue

[ Edited ]

I think what I need, is change the focus from the editfield when the cursor arrives to the last character, and the user press the right in the directional button.

 

But there is no easy way?

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

My good english is beceause i dont speak english
Developer
Posts: 16,842
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: EditField + HFM (HScroll) + NextFocus issue

you could overwrite moveFocus
----------------------------------------------------------
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
Developer
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: EditField + HFM (HScroll) + NextFocus issue

It's a problem of requirements: on one hand, EditField tries hard to allow the user to travel within the text with the trackball/touchpad. On the other hand, you want some quick way to jump to the button on the right without scrolling through all the characters in the EditField first. Decide what behaviour is preferrable for you.

 

You can add something less intuitive: say, program Shift+right movement (or Alt+right movement) to jump directly to the right, while the unmodified movements still control the EditField's cursor. You can do this in navigationMovement override, returning super.navigationMovement unless the status parameter indicates that a modifier key is pressed.

 

If you go this way, though, make sure the user of your application knows about 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!
Developer
Posts: 125
Registered: ‎08-11-2011
My Device: Blackberry Smartphone 9780
My Carrier: -

Re: EditField + HFM (HScroll) + NextFocus issue

[ Edited ]

Ok, first of all, thanks for the answers.. now, i am overriding navigationMovement, but, i dont know how find out if the direction pressed is the "right" , because, the "int status" is the same for right and left direction. 

 

Any suggest will be precious.

 

Edit :

 

I have another issue, when the focus is in the button :

 

Row 1 : In this row i have 3 fields.

 

HorizontalFieldManager (

 

Combobox, HorizontalFieldManager(TextField) with HorizontalScroll, ButtonField

 

)

 

So when the button have the focus and i press the right side direction button, the TextField run the horizontal scroll.. and i dont know why is this happen.

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

My good english is beceause i dont speak english
Developer
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: EditField + HFM (HScroll) + NextFocus issue

(dx > 0) == "right"

(dx < 0) == "left"

(dy > 0) == "down"

(dy < 0) == "up"

 

As for your second issue - I've seen it reported somewhere in the forum. Try adding the following to your navigationMovement override on your inner (scrolling, with EditField in it) HorizontalFieldManager:

if (!isFocus()) {
  return false;
}

 By the sound of it, that HFM somehow receives navigationMovement events even when it's not in focus...

----------------------------------------------------------
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
Posts: 125
Registered: ‎08-11-2011
My Device: Blackberry Smartphone 9780
My Carrier: -

Re: EditField + HFM (HScroll) + NextFocus issue

Thanks for your suggestions, really helped me.

 

Work everything except the issue of scrolling when the focus is in another field.

 

if (!isFocus()) {
  return false;
}

I think this is another bug, i find the post which you was talking and from what I understand, could not find a solution.

 

http://supportforums.blackberry.com/t5/Java-Development/Horizontal-scrollable-text-edit-field-issue-...

 

navigationMovement is never called when the focus is in other field.

 

May be removed scroll capabilities in onUnFocus() int the HorizontalFieldManager.. i dont know, it is possible?

Or in the last of the cases i will change the manager when onUnFocus for another manager whit NO_HORIZONTAL_SCROLL. I sincerely hope not to have to do this.

Thanks again.

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

My good english is beceause i dont speak english
Highlighted
Developer
Posts: 125
Registered: ‎08-11-2011
My Device: Blackberry Smartphone 9780
My Carrier: -

Re: EditField + HFM (HScroll) + NextFocus issue

[ Edited ]

Well, i was going crazy with this issue :

 

This work great for me :

 

ScrollChangeListener scrollListener = new ScrollChangeListener () {

public void scrollChanged (Manager manager, int newHorizontalPosition) {
	if (isFocus()){
		manager.setHorizontalScroll (newHorizontalPosition, true);
	}else{
		manager.setHorizontalScroll(0,false);
	}
}};

 and in the constructor.

 

setScrollListener(scrollListener)

 Im happy Smiley Happy

 

Thanks.

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

My good english is beceause i dont speak english