Hello,
I am displaying Base64-encoded strings in a textarea. When the TextArea is not wide enough to display the string on a single line and the string contains a /-character, then the line breaks at that position. This does not look good, especially if the strings are longer and containing a couple of /"-characters.
Example:
Make a TextArea (TextArea1) 300 pixels wide.
In the action Event of a button ad this code:
Note that there is a /-character after the first This.
Result after pushing the button: In the first line of the TextArea we have only This/ (the rest of the line is empty). The next part of the string begins in the second line of the textarea.
How can I avoid that lines in a TextArea break at the “/” character?
FYI this does the same thing in TextEdit
I think there’s a setting you can declare into that will turn off breaking lines at non alphanumeric characters
Norman and Dave,
thanks for your replies.
Ok, so there is no setting that I did not notice, that controls this behaviour in TextArea. After entering some long strings with the “/”-character into the textarea of other applications I see the same behaviour. So the Xojo-TextArea does the normal or expected thing. I did not notice this in other apps until now, probably because I usually do not often write long strings with Base64 encoding
It seems that I found a work around by displaying these strings in a html-textarea (https://www.w3schools.com/tags/tag_textarea.asp) using a Xojo-HtmlViewer. The html-textarea does not seem to wrap on the /-character. So I can create the necessary html code (let’s call it htmlString) on the fly an then do:
HTMLViewer.LoadPage(htmlString, Nil)
Hello,
in case that someone else also stumbles upon this problem, here is a little demo project (https://cmezes.com/dl/HTML-Textarea.zip) as a starting point of how to fake a TextArea with the HTMLViewer. Note: I did only test this on macOS…