Page 1 of 1

The styledText is an Array

Posted: Sun Aug 18, 2024 9:19 pm
by OpenXTalkPaul
Been busy working on an Extension Builder Editor this weekend, which is forcing me to catalog some features of xB, and spent some time looking at Property Inspector stuff.

I just now realized that 'the styledText, as found in field objects, is an array forma, different from the RTFText and the HTMLText of the styled text. I found out you can have a styledText property in a Widget (it's not really documented). The key/value format of this is kind of perfect in that it uses xTalk keywords for its keys ("textFont',"textColor",etc), just need to figure out how to render it on the Widget canvas, hopefully there's a way to use it 'as is', or I'll have to write a my own text-style-Array-to-canvas formatting mechanism.

Re: The styleText is an Array

Posted: Wed Sep 18, 2024 11:41 am
by tperry2x
Any demo stacks showing how this is implemented and works in practice would be brilliant. I can add them to my ever-growing examples folder.

Re: The styleText is an Array

Posted: Tue Sep 24, 2024 5:56 pm
by OpenXTalkPaul
tperry2x wrote: Wed Sep 18, 2024 11:41 am Any demo stacks showing how this is implemented and works in practice would be brilliant. I can add them to my ever-growing examples folder.
I meant to upload a screenshot at least, I kind of posted this as a place-holder, meaning to come back to it when I had time to.

To show what I'm talking about, here's a stack that provides a visual display of the structure of a field's styledText array in a Tree View widget to the right of it.
The styledText is an Array.oxtstack
(3.33 KiB) Downloaded 127 times
Screen Shot 2024-09-24 at 1.57.24 PM.png
Screen Shot 2024-09-24 at 1.57.24 PM.png (295.65 KiB) Viewed 7216 times

Re: The styledText is an Array

Posted: Wed Sep 25, 2024 8:56 am
by tperry2x
That's actually really rather useful. I'll add that to my sample stacks Library if that's okay.
Previously, I'd have had to inspect each character / line of a block of text to see if it had any formatting. This is handy as it gives you a tree view to see it at a glance whereas otherwise it might not be as obvious.
It's handy to know how the IDE is internally handling styling text, so this is obviously it's preferred method behind the scenes. It might be good to write that into a modified inspector, eventually...

Re: The styledText is an Array

Posted: Wed Sep 25, 2024 10:18 am
by OpenXTalkPaul
tperry2x wrote: Wed Sep 25, 2024 8:56 am That's actually really rather useful. I'll add that to my sample stacks Library if that's okay.
Previously, I'd have had to inspect each character / line of a block of text to see if it had any formatting. This is handy as it gives you a tree view to see it at a glance whereas otherwise it might not be as obvious.
It's handy to know how the IDE is internally handling styling text, so this is obviously it's preferred method behind the scenes. It might be good to write that into a modified inspector, eventually...
Sure, that's why I made this demo!
It makes sense that the engine would keep the data in some sort of Array / 'Dictionary' or struct(ured) format like this, but I haven't actually look at the structure in the Engine source (taking Richard's word on that). Arrays can be so much faster for searching through, vs text data, specially text that includes mark-ups that need parsing (the HTMLText, the RTFText).