cant't find the textFont of formatted text?

Mark Waddingham mark at livecode.com
Fri Jun 5 14:20:47 EDT 2015


On 2015-06-05 20:13, Dr. Hawkins wrote:
> inside of a loop through the fields, I have
> 
> put thFld & cr & the formattedText of thFld \
>     & cr & exists(the textFont of word 1 to -1 of the formattedText of
> thFld)
> put the textFont of word 1 to -1 of the formattedText of thFld
> 
> On a particular field, I get
> 
> field id 3132 of stack "rawForms"
> Estimated Number of Creditors
> false
> 
> How can this possibly be???  The error on the second line is
> 
> button "src_formsStack": execution error at line 89 (Chunk: can't find
> object), char 19

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.

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

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

Hope this helps,

Mark.

-- 
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps




More information about the use-livecode mailing list