The styledText is an Array

Organizing tasks to work on, New Features Ideas, Building LCS & LCB Libraries & Widgets, Redecorating and Modifying the IDE, Hacking / Editing Tools, Compiling the Engine from Source, etc.
Post Reply
User avatar
OpenXTalkPaul
Posts: 2793
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

The styledText is an Array

Post 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.
User avatar
tperry2x
Posts: 3488
Joined: Tue Dec 21, 2021 9:10 pm
Location: Somewhere in deepest darkest Norfolk, England
Contact:

Re: The styleText is an Array

Post 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.
User avatar
OpenXTalkPaul
Posts: 2793
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: The styleText is an Array

Post 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 7205 times
User avatar
tperry2x
Posts: 3488
Joined: Tue Dec 21, 2021 9:10 pm
Location: Somewhere in deepest darkest Norfolk, England
Contact:

Re: The styledText is an Array

Post 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...
User avatar
OpenXTalkPaul
Posts: 2793
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: The styledText is an Array

Post 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).
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests