3

I am using org.eclipse.swt.widgets.Text I am doing

Text description = new Text(container, SWT.SINGLE);
description.setEditable(false);
description.setText("long string");

About half of the text shows up in the wizard that I am creating. I see there is a static int called LIMIT in the API. I have not been able to find where it states there is a preset on the number of characters that the Text can hold. I want to expand this to the number of characters that I need.

Chris Bolton
  • 2,162
  • 4
  • 36
  • 75

2 Answers2

5

As the API mentiones, Text.LIMIT is a hard limit of the underlying native widget implementation. You can set the limit to another value using Text.setTextLimit(), but not larger than Text.LIMIT.

Maybe your text is not showing up, because you are using the single-line version of Text. Try instead

Text description = new Text(container, SWT.MULTI);

If it's also not working, try another widget without this limitation (e.g. StyledText).

Adam Taras
  • 1,403
  • 1
  • 13
  • 15
  • 1
    I would say that would not work indeed when using the multi-line text with the `SWT.MULTI` style bit. Looking at the source code, the limit is only applied when the `SWT.SINGLE` bit is set (org.eclipse.swt.gtk.linux.x86_64_3.105.3.v20170228-0512.jar). – Campa Jan 24 '20 at 10:58
2

Text.LIMIT (2,147,483,647 or 2^31) is the maximum number of characters that can be entered into a text widget. This value can change for each version of eclipse.

Computered
  • 440
  • 1
  • 7
  • 21