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.
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).
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
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
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
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;
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.