How to set Text Input to text wrap

I'm creating a text input in a Form where sometimes the input will get too long.
How can I set the text input to wrap?

Are you using a “Text Field” or a “Text Area”?

When you use a text area, there’s a “Line Wrap” option, under the “Behaviour” category. That should do exactly what you want.

be sure to make the text area large enough to get a decent scrollbar (at least 3 lines to give room to both arrow buttons and a small scroll bar itself).

Also note that you can set the default number of rows and columns of the text area. If this default number is bigger than the actual size of the text area, scrollbars will always be shown. If you want to hide scrollbars by default, you may need to make this number smaller.

1 Like

Ignition really should add Line Wrap to the Text Field component though.
You can wrap your text in "<HTML></HTML>" which will give you line wrapping functionality. Its very irritating to do this for everything though.I guess we could always create our own template, but it seems like something that should be inherently supported.

2 Likes

The entire point of the Text Area component is to add support for multiple lines. The Swing Text Field component (JTextField) expressly states:

JTextField is a lightweight component that allows the editing of a single line of text.

2 Likes

Thanks for your reply.
I want to use Text Field so the scroll bar won’t show up.

Since it seems that I can’t do it in Text Field, I have used Text Area instead, and set the rows to 2 so the scroll bar won’t show up.

Have you tried placing just a < html > (minus the spaces) tag in front of the text that appears in the field? I have used that before when I wanted to make text wrap.

Example: < html >This is the text in my text field

1 Like

what do you mean @casey.myers,
I want to use this for text input for a Form to be submitted and written in a database.
do you mean every time they key in something they need to type ?
where should I put the ?

I have tried and it does not wrap my text.

Since this topic is from 2017, it's probably wise to make sure you are using Vision, not Perspective. This topic was Vision.

Thanks for the reply. I am using Vision. I saw in another post that you could use
for line breaks which would be ideal, but sadly that is not working either :slightly_frowning_face:

Show what you have tried, maybe screenshots.

Zachary D Sobie | Controls Engineer

(attachments)

A text field doesn't work that way. To get line breaks you must use a text area component. It can be styled to look exactly like a text field.

1 Like

I tried that, but it's editable by the user and I do not want that

If you don't want it editable, there are plenty of ways around that. For example, you could use a label component, and if it needs to look like a text field, fill the background and give it a border.

What am I doing wrong?

Put <html> at the beginning of the string:

<html>INLINE<br>RINSE

You can also use to center align the text:

<html><center>INLINE<br>RINSE
3 Likes

That worked, thanks!

1 Like