02-03-2024 10:26 AM
02-03-2024 01:27 PM
So your text is one long string without line delimiters and you want it to dynamically re-wrap if the font size or indicator dimensions are changed?
I assume you are talking about an indicator, not a control, right?
The math will be a bit easier if you use a fixed width font (e.g. Consolas).
Can you explain the purpose of all this?
If each line is a linefeed delimited string to be dynamically appended to the indicator, all you might need is concatenate the new data on top.
02-03-2024 03:30 PM
Try this.
02-03-2024 04:06 PM
Saved by "going through a tunnel".
I (carelessly) read this post, and thought the Original Poster had a ListBox (which is what I thought he meant by "Text Box") and wanted to present it with the initial Selected Item the last item in the list (instead of the first). By the time I got off the train and was able to set up my laptop again, I saw the posts from Christian and Paul, and figured out that I was "answering the wrong question".
Bob Schor
02-03-2024 05:01 PM
@paul_cardinale wrote:
Try this.
That's a bit of a hack, because applying the operation twice does not restore the original string as one might foolishly expect. Might be OK is some use cases.
(Easiest to demonstrate by repeating the operation a couple of times. We get more and more empty lines in-between the text lines. Not easy to fix.)
02-04-2024 09:38 AM
@altenbach wrote:
@paul_cardinale wrote:
Try this.
That's a bit of a hack, because applying the operation twice does not restore the original string as one might foolishly expect. Might be OK is some use cases.
(Easiest to demonstrate by repeating the operation a couple of times. We get more and more empty lines in-between the text lines. Not easy to fix.)
OK. Just remove the concatenation of the End of Line Constant and it will work as you like.