Wrap text in groov text area / text box

Hi all
I have an application where I am displaying production information on a large TV in a factory floor. The managers want to be able to display text messages as well, and this is where I have gotten stuck… What I can’t find is a way to make the text wrap around so it stays in the text box / text area. At the moment, no matter what size I make the box / area, I only get one line of text, and part of the text is outside the box. I tried to manually break the line by adding the ASCII character 13 (Alt+0013) as well as trying ‘\n’ and ‘\r’, but neither was accepted in the text box gadget (Alt+13 was ignored, and the other apeared as text).

For my application I need to have dynamic text, so they can change it and display what the need, so I can’t pre-format the text as I don’t know what will be in the text box ahead of time.

Any thoughts?

Edit:
I notice that if I add static text in the properties box of the text area gadget, then I can have multiple lines if I insert them manually (hit enter while adding text), although it removes extra ones to remove any blank lines.
So the gadget can handle multiple lines, the question is how to get that into a dynamic text coming from a tag…
Also, it doesn’t seem to wrap text though, as far as I can tell.

Cheers,
Mattias

Advance warning, I have not had time to try this yet (But want to)…

For non-browser swallowing spaces, Mary has this hint here; Where did my Text Area extra spaces go?
(ALT + 255).

So, my quick thought is, since the text is coming from a controller, build the string in the controller that includes the special characters to display the text as needed.

(Also, let me check in with the groov software team and see if they have any thoughts).

Ok, groov software engineers suggest that “it should work to embed newline characters (ASCII 10, or 0xA) in the string” coming from the controller.

(If you can let us know how this works out, we would be grateful - I will have a crack at it when I can, but it could be a while).

I have tried to include 10, 13 and both of them in the string in the PLC, but with no luck. One of them is removed and the other becomes a blank space. I can’t remember which one did what.

I did see the tips and I have successfully used Alt+255 for a blank space. That was a great victory :slight_smile:

The solution I have come up with is to allow for the user to enter the string and insert up to three ‘#’-characters where they want the line broken. Then the PLC will split the text and put it to four text fields on the screen; one line each.
I am then putting a string containing Alt+255 (Hex FF) in any field with no text to make the default display of “- - -” go away. I want my fields to be compleately transparent when there is no text present.

I am also working on a second solution which will make a news-ticker type display. The PLC will move the caracters in the string along, making it look like it is scrolling the text across the screen.

It would be awesome if the text fields can word-wrap. It will save a lot of string manipulations, something most PLC’s aren’t great at. Especially in ladder logic :wink:

Some tips for other users reading this regarding string fields in gadgets and wanting to use ALT-codes for characters.
The 255 code, at least on my computer, must be entered on the key-pad. Not the numbers along the top of the key-board. I have a laptop, so that means I have to first press ‘Fn’ to activate the keypad, then ‘Alt’ and then ‘255’ (‘kii’ on the keyboard). I have been using Alt+0176 for degree symbols, so my first tries were to use Alt+0255. That does not work…
So, if you are struggling, try the things above :slight_smile:

Cheers,
Mattias

1 Like

Try chr(13)+chr(10)
I haven’t tried it but 13 and 10 is carriage return and line feed (new line).

Has anyone been able to format a String using OptoScript that puts a new line in a text area? I am trying
System_Msg = "Modbus Read Failure. " + Chr(255) + " READ PARAMETERS Error #" + ScratchString;

but get this

Modbus Read Failure. � READ PARAMETERS Error #2

I Tried that but no luck either

I tested several combinations and can’t get a line feed to show in the text area gadget.
Looks like you will have to use two strings in the strategy and two text area gadgets in groov Build.

Is this a defect or does fall under an enhancement request?

Enhancement.
I will submit one for you.

1 Like