Two features I don't understand

Trevor DeVore lists at mangomultimedia.com
Fri Oct 31 07:42:12 EDT 2014


On Thu, Oct 30, 2014 at 2:36 PM, Richard Gaskin <ambassador at fourthworld.com>
wrote:

>
> 2. StyledText array
> Pages 16-18 of the v5.5.4 Release Notes:
> <http://downloads.livecode.com/livecode/5_5_4/LiveCodeNotes-5_5_4.pdf>
>
> Anyone here use this?  Is it faster than doing equivalent operations on
> htmlText?  While the style attributes themselves are well represented in
> the array, the character offsets of runs don't seem to be present, so I'm
> unclear as to what this should be used for.
>

Richard,

I use styled text all of the time in my text editors and exporters. Mainly
for modifying runs of text and for converting text to other formats. Two
examples:

1) Converting text to different types of markup. Markdown, BBCode, etc.
Looping through a styledText array makes it trivial to convert to other
text formats.

2) Modifying formatting in text. It is trivial to loop through the
styledtext array and strip out styles you don't want, add in metadata you
do want, etc. What if you want bold and italics but not color when the user
pastes text? The code is much simpler to write and easier to read using a
styledText array. It is much faster than looping through the text in a
field and checking styles.

-- 
Trevor DeVore
ScreenSteps
www.screensteps.com    -    www.clarify-it.com



More information about the use-livecode mailing list