bobcole wrote: Sun Sep 04, 2022 8:52 pm
According to the Dictionary, the StyledText property is an array.
This little example stack gets the array of an example field and puts the array into a Tree View widget.
The widget allows us to see how the array is structured.
Perhaps the visual representation will help us decipher the problem and determine a solution.
FYI,
Bob
StyledTextArray.livecode.zip
Well Bob, that thickens the plot.
I note the text in your stack is nicely spaced and weirdly everything works as expected.
However if you put a new field in it's place and just add text and style it (i.e. not nicely spaced), the fault i reported above still occurs.
I've modified the your stack:
- I've added a 'destination' field to which the styled text of the 'source' can either be pasted or target of a 'set' command
- added buttons to set the 'source' field to either your nicely 'spaced' or text that is 'native', ie just entered with no styling and then have the styles applied.
- I've also added a second tree widget to show what arrays the clipbardData["styledText"] holds
- And finally an option to paste text from source to destination or set the styledText of destination to the styledText of the source.
Weirdly:
If your text is set as source, it works beatifully
If instead the native text is set as source, it generates the same error as what i mentioned above.
Any ideas?
I wonder if text with no attributes or text set as 'plain' causes the issue as in your case,
all text has some attribute (even the apparently unstyled text has the style of spaceBelow = 10)