language syntax question
Peter Haworth
pete at lcsql.com
Wed Nov 19 15:23:28 EST 2014
I've run into the first issue many times. It seems that if the property
you are trying to get is a not a valid property of the referenced
container, then all works fine. If it is a valid property, then what you
get is that property of the container.
So in your example:
Function something obj pl
Get the formattedrect of line pl of obj -- this works fine
Get word 1 of the text of line pl of obj -- this what I want to do but
the syntax is wrong
End something
... "formattedRect" is not a valid property of obj so it works fine. But
"word" is a valid property of obj and and so is "text" so what you get is
whatever is in word 1 of line 2 of the contents of obj. In your example,
there is only 1 line so you would get empty not word 1 of line 2 of field
"foo".
Others will hopefully correct me if I'm misinterpreting this but that has
been my experience. The only way I've found around it is to construct a do
command:
do "get word 1 of line pl of" && obj
In answer to your second question, no need to include the "@" when passing
the variable to the second handler.
Pete
lcSQL Software <http://www.lcsql.com>
Home of lcStackBrowser <http://www.lcsql.com/lcstackbrowser.html> and
SQLiteAdmin <http://www.lcsql.com/sqliteadmin.html>
On Wed, Nov 19, 2014 at 10:57 AM, Mike Doub <mikedoub at gmail.com> wrote:
> i have been struggling with a couple of language issues and I hope some one
> can set me straight.
>
> Issue 1). What is the syntax to get the contents of a field when you have
> the long IDE to the field.
>
> Put something ( long ID of field "foo", 2) into x
> ...
>
> Function something obj pl
> Get the formattedrect of line pl of obj -- this works fine
> Get word 1 of the text of line pl of obj -- this what I want to do but
> the syntax is wrong
> End something
>
>
> Issue 2). Can a reference to a variable be passed thru the message path
> with a send command?
>
> Local foo
> Put "stuff" into var
> doit var
> ...
>
> On doit @thevar
> Put "ed" after thevar
> -- here I want to send the reference to another handler
> Send "another" & @thevar In 1 second-- this is where I want the reference
> to be sent and I
> -- know the syntax is wrong
> End doit
>
> On another @thevar
> If thevar = "stuffed" then answer "it worked"
> End another
>
>
> Regards,
>
> Mike
> _______________________________________________
> 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