I reviewed (and originally posted to) this old thread:
https://support.rossvideo.com/hc/en-us/community/posts/360040143591-Set-2-line-text-limit-with-word-wrap-enabled
However, as this didn't get any traction, I thought I'd start a new one with my question:
I have a significant amount of visual logic running, and as a result, this script in the old thread doesn't work for (in part because the context of the text field I need to wrap is dynamically set via visual logic). I have tried to replicate the script, or my own variant of it in visual logic, but have encountered other issues, such as using the logic block to find a " " character to split lines doesn't return correctly if the start point if after the last space character. Also, the concatenate block does not allow me to add a CR/LF code into the text, or at least I haven't figured out how.
Is there an easier way to constrain a text box to two lines high? Or does someone have a good example of a visual logic approach to this?
In terms of pseudo code, I see it like this:
If text.width < box.width, exit
If text.width < box.wdth * 1.1, autosqueeze = true 'allows a small amount of squeeze on one line
If text.width > box.width * 1.1, find split point at first line length or midpoint depending on length, insert a CR to make it two lines
Any help appreciated!
Thanks, Dave