StyledText replacement

The StyledText class is very useful for things like concatenating TextAreas, but is quite limited. For example, I have hypertext links in TextAreas (made with MBS) that are lost when getting the StyledText. Superscript and subscript are lost as well. Since a TextArea is an NSTextView these properties are available in the RTF, but not represented in StyledText. I can’t find an equivalent but more extensible replacement in MBS, but maybe I missed something?

Take a look here: GitHub - atomiccity/FormattedTextControl: The Formatted Text Control for Xojo

1 Like

Thank you, I will.

If your app is macOS based, you could use NSTextView* classes in MBS Xojo Plugins.
Including the NSTextViewControlMBS.

And of course NSMutableAttributedStringMBS class to edit styles.

But is there anything. analogous to StyledText there? Something I can iterate over by style runs and modify? I use that extensively when converting between different sorts of output (RTF, HTML, Text, Markdown, etc.).

yes, NSMutableAttributedStringMBS class does it.

you can make a loop with

 attributesAtIndex2(location as UInt64, byref range as NSRangeMBS) as dictionary

and loop over all ranges to learn what attributes they have.

Very interesting, thanks.