Location of Handlers that Trap Messages

Eric Chatonet eric.chatonet at sosmartsoftware.com
Tue Jun 19 08:51:33 EDT 2007


Hi Greg,

Le 19 juin 07 à 14:36, Gregory Lypny a écrit :

> I'm a little rusty here.  Does it matter much where I place  
> handlers that trap openCard, closeField, and such messages?  In a  
> simple stack, I put them all in the stack script, but I guess I  
> could put them in group script.  I'm interested in speed as opposed  
> to which controls will receive a message because they lie in its path.

Actually, I never found a real difference but I always take advantage  
of a location or another:
For instance, openCard in the stack's script will be triggered by any  
card.
At the contrary, preOpenStack in the first card's script will only be  
triggered by the main stack but not by its sub stacks, etc.
To get a reliable code without any repetition (indispensable for a  
reliable maintenance), it is often handy to put handlers at a high  
level using parameters in addition to get the most generic code you can.
If you have 2.8 you might be interested in the new 'private' command  
(but only for your custom handlers) that allow to gain speed.

Best regards from Paris,
Eric Chatonet.
----------------------------------------------------------------
Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/
Email: eric.chatonet at sosmartsoftware.com/
----------------------------------------------------------------





More information about the use-livecode mailing list