Behaviors and scripts and a new handler structure...

Paul Dupuis paul at
Thu Apr 1 15:51:28 EDT 2021

I have increasingly been using behaviors in my applications where it 
makes sense to assign a script to multiple objects or to override the 
actions of existing script handlers by assign a behavior with different 
version of those handlers.

The one thing I dislike about behaviors is all the objects I need to 
create (a button for this behavior another button for that behavior 
script and so on).

I'd love to see a new LCS structure like the following:

behavior <behaviorName>

<series of one or more handlers>

end <behaviorName>

that you can just have in a script. Even multiple behaviors in the same 
script perhaps each with their own 'mouseUp' handlers and then you can 
set the behavior of an object to a behavior name and done. Obviously, 
any messages (i.e mouseDown, mouseUp, etc. etc.) in the behavior block 
should never received a mouseDown, mouseUp, etc. message unless sent to 
the object tat have the behavior assigned to it.

I think it would make code maintenance potentially much easier. I don't 
have any idea how much of a engine change such a addition to the 
language would represent.

Anyone else think this is a good idea?

More information about the use-livecode mailing list