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: 98
Registered: ‎12-29-2009
My Device: Bold
My Carrier: Rogers

RichTextField--Scroll (when press 'b' or 't')

I was able to get this procedure to work with a HoriztonalFieldManager (the manager would scroll to the bottom when the 'b' key was pressed, and scroll to the top when the 't' key was pressed), but I can't seem to find the correct method to create a similar feature for a RichTextField.

 

HorizontalFieldManager has "setVerticalScroll(HorizontalFieldManager.topmost).

 

Does RichTextField have a similar feature?

 

I'm thinking it's somehow connected to 'movefocus,' but I'm not sure how to go about implementing it.

 

Any ideas?

 

Thanks!

 

Developer
Posts: 17,019
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: RichTextField--Scroll (when press 'b' or 't')

setCursorPosition maybe?

----------------------------------------------------------
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: 98
Registered: ‎12-29-2009
My Device: Bold
My Carrier: Rogers

Re: RichTextField--Scroll (when press 'b' or 't')

The Api documentation states that the setCursorPosition method "Places cursor on specific character within this field, at user request...an offset of zero represents the first character in this field's text value."

 

Can I obtain set the offset to 'x' where 'x' is the last character in my RichTextField?

 

Will the RichTextField then automatically scroll so the new position that I set the cursor to is visible?

Developer
Posts: 467
Registered: ‎07-16-2009
My Device: Z10 LE
My Carrier: Vodafone NL

Re: RichTextField--Scroll (when press 'b' or 't')

Maybe wrap Field with Manager?

Developer
Posts: 98
Registered: ‎12-29-2009
My Device: Bold
My Carrier: Rogers

Re: RichTextField--Scroll (when press 'b' or 't')

I suppose the code might look like this:

 

 

//get the total characters in the RichTextField
int _textlength = RichTextField.getTextLength(); 

//set the cursor position to the last character
RichTextField.setCursorPosition(_textlenght); 

 

 

 

Do you think the RickTextField will automatically scroll to show where the 'setCursorPosition' is now stationed?

 

Developer
Posts: 98
Registered: ‎12-29-2009
My Device: Bold
My Carrier: Rogers

Re: RichTextField--Scroll (when press 'b' or 't')

Hi Eugen,

 

I've heard that term used before "wrap"--what does it mean in this context to "wrap Field with Manager"?

 

Developer
Posts: 467
Registered: ‎07-16-2009
My Device: Z10 LE
My Carrier: Vodafone NL

Re: RichTextField--Scroll (when press 'b' or 't')

Put field inside the manager.

And use your previous code with manager that is already  working.

Developer
Posts: 98
Registered: ‎12-29-2009
My Device: Bold
My Carrier: Rogers

Re: RichTextField--Scroll (when press 'b' or 't')

I will give that a shot as well.  I tried it already, but I also added the manager scroll code to the RichText's code--perhaps it is a causing a conflict and that is why it is not working properly.

 

I'll let you know how it pans out.

 

Developer
Posts: 467
Registered: ‎07-16-2009
My Device: Z10 LE
My Carrier: Vodafone NL

Re: RichTextField--Scroll (when press 'b' or 't')

Check carefully that RichTextField doesn't handle your key events that you want to process in manager.

Highlighted
Developer
Posts: 98
Registered: ‎12-29-2009
My Device: Bold
My Carrier: Rogers

Re: RichTextField--Scroll (when press 'b' or 't')

True--that's what I'm going to do.  I think that's where I went wrong.

 

Thanks Eugen...

 

I'll post a solution if I find it and send a kudos your way after testing...