cant't find the textFont of formatted text?

Dr. Hawkins dochawk at gmail.com
Fri Jun 5 20:41:36 EDT 2015


On Fri, Jun 5, 2015 at 11:20 AM, Mark Waddingham <mark at livecode.com> wrote:

>
> The 'formattedText' property of a field is a string so the expression:
>   the textFont of word 1 to -1 of the formattedText of thFld
>
> Does this:
>   T1 = evaluate the formattedText of thFld
>   T2 = word 1 to -1 of T1
>   return the textFont of T2
>
> Now, because T2 is also a string, the engine tries to interpret it as a
> control reference.
>

Shouldn't it return "empty" then?

>
> If you want to access properties of the styled text of the field, then you
> need to do so directly on the field itself:
>   put the textFont of word 1 to -1 of field thFld
>

OK, I see that's better (I had to go to formatted text at some point
because something else wasn't working.  Or maybe that was before I focused
on words.  I think it was when I was trying to null out the textSize &
textFont of the pasted text to force it to use the field's settings)

(oh, and thFld was actually an id, not a field name)


> As an aside, you also cannot use 'exists()' on font names - it is only for
> control references. Instead you can use:
>   (the textFont of word 1 to -1 of field thFld) is among the lines of the
> fontNames
>

exists() entered late while debugging it.
word 1 to -1 of  theFld
did it

But I'm still troubled by this plowing through over 150 fields before it
found one it didn't like this on . . .

-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462



More information about the use-livecode mailing list