Comment about "do" (was clickLine/clickcharchunk)

dunbarx at aol.com dunbarx at aol.com
Wed May 8 09:31:40 EDT 2013


Good stuff Geoff.


So, as compactly as I can make it:



on mouseUp
   get the clickline
   set the text of it to random(99) --works
   put random(99) into it --does not work
end mouseUp


shows the distinction between the ability of the engine to set a property contained in a variable, but not use a variable as an evaluated property reference.


OK.


Craig Newman



-----Original Message-----
From: Geoff Canyon <gcanyon at gmail.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Wed, May 8, 2013 9:19 am
Subject: Re: Comment about "do" (was clickLine/clickcharchunk)


On Tue, May 7, 2013 at 9:29 PM, Richard Gaskin
<ambassador at fourthworld.com>wrote:

> ...we can simply write with confidence:
>
>  set the text of tObject to resDate
>


Richard, you beat me to it -- and here I thought I might be the only one
who understands the distinction.

This works (as far as I know) with all properties. If a variable contains a
reference to something that has properties -- an id, name, chunk, etc, --
then referencing those properties will work. It's a bit tricky. I was going
to say that "into" does nothing special, but "of" dereferences the variable
to whatever it identifies, but that's not true. For example, this
successfully updates the line *after* the one you click:

on mouseUp
   get the clickline
   add 1 to word 2 of it
   set the text of it to random(99)
end mouseUp

So I have to go back to the original: you can set a property on a variable
containing a reference, and LC will use the reference. "of" alone isn't the
magic word here.
_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

 



More information about the use-livecode mailing list