LiveCode 4.6.1 message path and behaviors

Björnke von Gierke bvg at mac.com
Mon May 23 08:12:16 EDT 2011


I agree with your assesment that the message path is so versatile and complex, that it doesn't lead to a single ruleset, but to a dozen different valid usage scenarios. But only if one chooses to use all these advanced capabilities. 90% of my works is within the 'default' path, not using libraries or behaviours, @ signs or backscripts. I do use send often tho, more out of habit to not create large stack or group scripts, then out of necessity.

Just to make the use of several libraries clear:
Librarystacks, front and backscripts can call each other at any time. But not if you call a handler that exists in several of them. For example, if you have two handlers in two librarystacks, one of the will fire and the other wont. The one that fires will be the one added last to 'the stacksInUse', and you can see the order in that property. So if you make scripts like the following example, and librarystack 1 was added last, you'll run into an recursion limit error. If library2 was added last, "two" will appear in the message box, and that's it.

library1:
on myHandler
  put "one" & space after msg
  myHandler
end myHandler

library2:
on myHandler
  put "two" & space after msg
end myHandler

On 23 May 2011, at 10:12, Keith Clarke wrote:

> 
> 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/
> 
> 
> _______________________________________________
> 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