0

I have a class which extends LabelField to set font and color. I have 2 such custom LabelFields and they display some strings of text. Those Strings are rather short, about a dozen symbols long.

The problem is that these custom LabelFields enforce new lines. They break my strings and display them in 2 lines instead of only 1 (no matter if a String is 6 or 12 characters long).

How to make these LabelFields stop enforcing new lines? I need to have one line stay one line.

Update: I have found the reason of that problem. The problem was on another level, - in the process of calculation of width and height for my popup Screen which contained those LabelFields.

Dmitry
  • 161
  • 1
  • 1
  • 6
  • 1
    This sounds odd. This might be related to the manager. Case 1: if the manager does not take all screen width. Case 2: if manager tells your label field it is allowed to use some part of the screen (versus the whole screen width). What manager do you use? Can it restrict the width for your field? – Vit Khudenko Nov 18 '11 at 20:44
  • I use UiApplication.getUiApplication().pushModalScreen(_popup) where _popup is an instance of the Screen subclass. – Dmitry Nov 21 '11 at 11:51
  • This does not tell much. It's still unclear what field manager you use. Probably edit your question and post the code where you construct UI for the popup. – Vit Khudenko Nov 21 '11 at 20:01

1 Answers1

2
you can use the style LabelField.ELLIPSIS to force the single line.

like

LabelField l = new LabelField("your text",LabelField.ELLIPSIS);
Vivek Kumar Srivastava
  • 2,158
  • 1
  • 16
  • 23
  • Please post your CustomLabelField code to identify the issue. By the way, you may need to use super(text, LabelField.ELLIPSIS); in the constructor of the CustomLabelField – Vivek Kumar Srivastava Nov 21 '11 at 12:21
  • Thank you. I have found the reason of that problem. There was nothing wrong with setExtent(). The problem was in the process of calculation of width and height for my popup Screen, and I had not found it before. – Dmitry Nov 22 '11 at 17:21