3

I must show a string that can or not be large enough to not fit in one line in all devices, I want labelfield control to automatically show remaining text in a "new line" after the original one, I mean like... auomatic carret return if the string cannot be showed in a single line, all mobile OS I have tried do this, but I cannot make BB OS to work, it just truncates my string whenever it likes and it's very annoying.

Thank you

Michael Donohue
  • 11,606
  • 5
  • 29
  • 44
Kenny D.
  • 887
  • 3
  • 10
  • 29
  • Is this for a web app, or a java app? Typically, questions on stack overflow include relevant code with the problem. – Michael Donohue Jun 22 '11 at 01:04
  • java, well I can add code, but I think it's not a particular problem, I just want basically: Labelfield myLabel = new Labelfield(LARGE_STRING); this.add(myLabel); to span in multiple lines at screen, so all the LARGE_STRING can be viewed, because currently all it does is show the label on a SINGLE line, and if the string doesn't feet in that unique line, it just cuts the string there, and remaining characters are just not showed. The problem here is that all devices have different width so I cannot manually make a labelfield for each line of the string and manually distribute LARGE_STRING – Kenny D. Jun 22 '11 at 01:51

1 Answers1

8

One way to do this is put your HorizontalFieldManager that contains the LabelField inside a VerticalFieldManager.

E.g.

LabelField labelField = new LabelField("This is a very long sentance that I have written to show that the text will wrap around when it gets to the edge of the field.");
VerticalFieldManager vfm = new VerticalFieldManager();
HorizontalFieldManager hfm = new HorizontalFieldManager();
hfm.add(labelField);
vfm.add(hfm);

add(vfm);
Ray Vahey
  • 3,045
  • 1
  • 21
  • 23
  • Thank you very much, exactly what I was expecting :D, marked as answwer, note for potential people that would want this, to add another element to this behavior, what I did was make a hfm for each controll and all them to vfm. – Kenny D. Jun 22 '11 at 20:38