Re: cant't find the textFont of formatted text?

2015-06-05 Thread Mark Waddingham

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 ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: cant't find the textFont of formatted text?

2015-06-05 Thread Dr. Hawkins
On Fri, Jun 5, 2015 at 11:20 AM, Mark Waddingham m...@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
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode