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
New Developer
mico
Posts: 20
Registered: ‎04-11-2009
My Device: Not Specified
Accepted Solution

How to make enable wrapping for TextField?

How to make a TextField with (TextField.NO_EDIT_MODE_INPUT | TextField.READONLY) wrappable like this:

 

 

If 'to' string is less than a specific width (~screen width) then it's only singleline, if more then it is multiline.

Developer
rafo
Posts: 507
Registered: ‎07-15-2008
My Device: Not Specified

Re: How to make enable wrapping for TextField?

I see no easy way like providing a constant in constructor.

 

You need to create your own custom field for such purposes.

----------------
if your issue solved set "Solution" mark at the relevant post
Developer
Rajat_10Sep
Posts: 696
Registered: ‎12-02-2008
My Device: Not Specified

Re: How to make enable wrapping for TextField?

Hi,

 

Instead of using single textField you can use One LabelField and One TextField if it fits you requirement.

 

Here is the code for it

 

HorizontalFieldManager managerHorz = new HorizontalFieldManager();
VerticalFieldManager managerVert1 = new VerticalFieldManager();
VerticalFieldManager managerVert2 = new VerticalFieldManager(); 

 

LabelField objLabel = new LabelField("ORANGE"){
             public void paint(Graphics g){
                    g.setColor(Color.RED);
                    super.paint(g);
                }
          };
       managerVert1.add(objLabel);
     
      BasicEditField objBasic = new BasicEditField();
      managerVert2.add(objBasic);
     
      managerHorz.add(managerVert1);
      managerHorz.add(managerVert2);
     
      add(managerHorz);

Regards,
Rajat Gupta.
--------------------------------------------------------------------------------
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish
New Developer
mico
Posts: 20
Registered: ‎04-11-2009
My Device: Not Specified

Re: How to make enable wrapping for TextField?

Thank you for quick responses. Another question on this is - is there any way to make a textfield which height can vary depending on it's contents(like in prev pic).
Developer
Rajat_10Sep
Posts: 696
Registered: ‎12-02-2008
My Device: Not Specified

Re: How to make enable wrapping for TextField?

Hi,

 

See this thread.

 

http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&message.id=15944&query.id=95...

Regards,
Rajat Gupta.
--------------------------------------------------------------------------------
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish
Developer
BBDeveloper
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: How to make enable wrapping for TextField?

Give a look at this KB article too.

 

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800345/...


Use Search. "Accept Solution" If the problem is resolved.