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.
The styledText is an Array
- OpenXTalkPaul
- Posts: 2793
- Joined: Sat Sep 11, 2021 4:19 pm
- Contact:
- 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
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.
- OpenXTalkPaul
- Posts: 2793
- Joined: Sat Sep 11, 2021 4:19 pm
- Contact:
Re: The styleText is an Array
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.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.
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.
- 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
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...
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...
- OpenXTalkPaul
- Posts: 2793
- Joined: Sat Sep 11, 2021 4:19 pm
- Contact:
Re: The styledText is an Array
Sure, that's why I made this demo!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...
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).
Who is online
Users browsing this forum: No registered users and 0 guests