curiosities in object reference
Michael Doub
mikedoub at gmail.com
Mon Apr 20 16:56:23 EDT 2015
The findTextInStyledText function within the MasterLibrary might be
helpful in this case. Pass it a string to find and the styledText
array and it will return to you the LineIndex, RunIndex and Starting
char within the run.
The MasterLibrary is here...
https://www.dropbox.com/s/3wpwn3hfbmpl7sk/MasterLibrary.livecode?dl=0
I just updated the Library to version 40. Somehow a very premature
version of findTextInStyledText found it way into the library. A
useful version is now in place.
Richard and others, since you are now playing with styled text, how
about sending me a wish list of functions that you think would be
useful. I can tinker away at them.
Regards,
Mike
On 4/20/15 10:44 AM, Richard Gaskin wrote:
> Mike Bonner wrote:
>
> > I wish it was easy to work with "the styledtext" but multiple runs
> > get really convoluted. They contain the actual text though, so if
> > you're better at navigating arrays than I am, it might be possible
> > to "put the styledtext of fRef into tStyledA" then make adjustments,
> > then "set the styledtext of field fRef to tStyledA"
>
> I've come to enjoy working with styledText arrays since I asked about
> them here last year. Very helpful for many things, but in this case
> I'd use the simpler htmlText, designed as it is to provide a
> plain-text representation of field contents with complete fidelity,
> and it works on chunks as well as the field object as a whole.
>
More information about the use-livecode
mailing list