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: 46
Registered: ‎01-14-2011
My Device: Talladega
My Carrier: Telus
Accepted Solution

Horizontal Scroll Custom TextFields

Hello friends. I'm trying to create a textfield that automatically scrolls horizontally when the field gets full. I'm using a custom TextField Class shown below which I've reduced for simplicities sake. I've also included the call I'm using. Any ideas why this wouldn't produce a horiztontally scrolling textfield? Thanks everyone much love.

 

 

//Creating a new TextField within a HorizontalFieldManager

HorizontalFieldManager mgrFirstName = new HorizontalFieldManager(HORIZONTAL_SCROLL);

TextField FirstName = new TextField(BasicEditField.NO_NEWLINE, HORIZONTAL_SCROLL);

mgrFirstName.add(FirstName);

add(mgrFirstName);

 

 

/* Custom TextField Class */

public class TextField extends HorizontalFieldManager

{

 

   public BasicEditField bEdit = null;

 

            public TextField(long Style, long scroll)

               {
                  super(scroll);

                  bEdit = new BasicEditField(Style);
                  add(bEdit);           

                }

}

Developer
Posts: 46
Registered: ‎01-14-2011
My Device: Talladega
My Carrier: Telus

Re: Horizontal Scroll Custom TextFields

Oh by the way this creates the textfield however when it reaches the end of the viewing area the text just goes off screen.

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

Re: Horizontal Scroll Custom TextFields

Here is a link to a knowledge base article which solves this problem. If you want to beautify the gadget, make sure to read the comments:

Scrollable one-line text input field

----------------------------------------------------------
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: 46
Registered: ‎01-14-2011
My Device: Talladega
My Carrier: Telus

Re: Horizontal Scroll Custom TextFields

Thanks, I'll give this a read and accept as solution if it helps.

Developer
Posts: 46
Registered: ‎01-14-2011
My Device: Talladega
My Carrier: Telus

Re: Horizontal Scroll Custom TextFields

Didn't help I made my BasicEditField an EditField as your article showed but the same thing is happening.

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

Re: Horizontal Scroll Custom TextFields

The article shows something else - you need to envelop the field with a Manager with HORIZONTAL_SCROLL in order for it to work. Use the whole gadget (class OneLineTextField) instead of parts of 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: 46
Registered: ‎01-14-2011
My Device: Talladega
My Carrier: Telus

Re: Horizontal Scroll Custom TextFields

Thanks it works - you're right it's gotta be in the manager. Kudos plus solution.

Contributor
Posts: 24
Registered: ‎01-24-2011
My Device: 4.2.1(8800), 4.6(9000), 4.7 and above

Re: Horizontal Scroll Custom TextFields

[ Edited ]

Hi arkadyz,

            The horizontal scroll works well no doubt when adding chars. However my problem is that while deleting chars once they have gone beyond the fld size.   The chars get deleted till one one char is displayed in the field and then the earlier entered chars start to get displayed.

Expected Behaviour: While deleting chars the cursor shud remain at end of field till the no. of chars are greater than width of the field.

So what could be the solution to this?

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

Re: Horizontal Scroll Custom TextFields

This is expected. The code, after all, uses BlackBerry standard fields and managers, and a manager does not change its scrolling position unless focus rectangle becomes outside of the current visible region. Your "expected behaviour" is not at all expected - it is the way Windows implements its own scrolling text box, which is not present in the BlackBerry OS.

 

If you want to design your own field/manager behaving like you've described, start a separate topic and we can ponder some ideas. Posting in a solved thread is almost useless - people mostly skip them thinking that there is nothing more to discuss.

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!