How to use several "StyledText.Underline" in a TextArea

I would like to use StyledText.Underline in a TextArea. Once it works fine.
But as soon as I try to underline several different places (interrupted with non underlined text) only the last one is underlined.
The earlier ones are normal again.

What am I doing wrong?
Thanks and good health!

PS: I’m working on and for MacOs.

show how you are doing it

The TextArea I’m writing into is part of a subtiling app. Into the Textstring I have to implement control characers for video that have to be shown in a human readable form. Thus I try to write the control codes als letters with underscore using Methods like this:

[i]Select Case UT_Text_Cont_3.Aktuelle_Zeile
Case 1 //unten

Sel_Start=UT_Text_Cont_3.Zeile_unten_TextField.SelectionStart
UT_Text_Cont_3.Zeile_unten_TextField.Text=Left(UT_Text_Cont_3.Zeile_unten_TextField.Text,Sel_Start)+“Y”+Right(UT_Text_Cont_3.Zeile_unten_TextField.Text,Len(UT_Text_Cont_3.Zeile_unten_TextField.Text)-Sel_Start)

UT_Text_Cont_3.Zeile_unten_TextField.StyledText.Underline(Sel_Start,1)=True

Case 2 //mitte …


end[/i]

As I said the problem is that if I write the 2nd code the first loses his underline.

Every time you set .Text, it clears all styles. Maybe use .AppendText instead.

Thanks, Tim!
.AppendText just has been deprecated. I’ll test with .AddText if this makes a difference.

Please use .selText to change text with new style.

e.g.

textArea1.selstart = position textArea1.sellength = 0 textArea1.selunderline = true textArea1.seltext = "New Text"

to insert some new text with underline

AppendText- deprecated

[quote=484232:@Emile Schwarz]Thank you Franco.

Note that it is not there: https://documentation.xojo.com/api/deprecated/textedit.html
and therefore I cannot saw it (and I checked also TextField and TextArea) :wink:

Alberto: this is why I wrote the Flag “deprecated and removed” feature request.[/quote]
Correct as I did not see it there either

[quote=484222:@Emile Schwarz]Where is it noted ?

I do not found it here .[/quote]

Click your link. Scroll down to 2019 Release 2, click on Full List of 2019r2 Deprecations, click on next page until you reach T section you will see TextEdit.AppendText

For a list of all deprecations (not for a particular release), you can visit this page.

Edit: the problem is that the deprecations page is multi-page, as you found out, you can’t issue a Find to search for other things not displayed on the page.