LiveCode 4.6.1 message path and behaviors
Keith Clarke
keith.clarke at clarkeandclarke.co.uk
Mon May 23 04:12:10 EDT 2011
Ken, thanks for the clarification on what can/can't be achieved with send - and how.
I like the use of the value function to wrap a remote function, which produces a kind of 'call, with (slightly fussy syntax) parameters' function - reminiscent of some Excel cross-referencing functions.
Interesting too, the lack of specific order within Library and Front/Back script 'containers'.
Best,
Keith..
On 23 May 2011, at 00:19, Ken Ray wrote:
>
>> don't address a person directly, maybe someone else would have helped, but now
>> you scared them away :P
>
> Not all of them.. ;-)
>
>
>> You where right on the send part not accepting arrays, i never realised that,
>> funny.
>
> Actually, "send" *does* accept arrays... it's just that you have to
> structure the send a little differently:
>
> on mouseUp
> put "Ken" into tNameA["First"]
> put "Ray" into tNameA["Last"]
> send "ShowName tNameA" to me
> end mouseUp
>
> on ShowName pNameA
> put "My name is:" && pNameA["First"] && pNameA["Last"]
> end ShowName
>
>> There's 2 types of handlers, functions and commands, both are interchangeable
>> considering the message path, with the caveat that you can't send or call
>> functions. handlers are run by just using their name, while functions behave
>> like a container (sort of).
>
> Sorry - you can call functions with the value() function - it's pretty
> rarely used (granted), but it *does* work:
>
> Script of Btn 1:
>
> on mouseUp
> put "Ken" into t1
> put "Ray" into t2
> put value("RemoteFunction(" & t1 & "," & t2 & ")",long id of btn 2)
> end mouseUp
>
> Script of Btn 2:
>
> function RemoteFunction pParam1,pParam2
> return (pParam1 && pParam2)
> end RemoteFunction
>
> (BTW: Note that if I'd used:
> put value("RemoteFunction(t1,t2)",long id of btn 2)
>
> it would have put "t1 t2" instead of "Ken Ray".)
>
> The other thing to be aware of is that (if I remember correctly) all
> libraries are at the same "level"; that is, even if you load Library A first
> and then Library B, Library B can still execute commands in Library A. Same
> goes for frontscripts calling each other, and backscripts calling each
> other.
>
> Just my 2 cents,
>
> Ken Ray
> Sons of Thunder Software, Inc.
> Email: kray at sonsothunder.com
> Web Site: http://www.sonsothunder.com/
More information about the use-livecode
mailing list