Front scripts vs Behaviors

Peter Haworth pete at
Wed Aug 11 00:03:47 EDT 2010

I'm currently using front scripts to handle common events for  
different types of controls.  For example, I have menuPick, mouseDown,  
and mouseUp front script handlers that deal with what I want do in  
those events for option menu buttons.  They all pass the event on so  
the real controls can have their own local logic in addition to the  
common logic in the front scripts.

I guess I'm wondering if it might be better to use behaviors instead  
of front scripts.  The front scripts seem to work just fine but I had  
to jump through several hoops to prevent them from intercepting  
controls I didn't want them to handle, for example everything in the  
rev IDE, and I think some of the occasional hangs I get in Rev might  
be because of these front scripts.  It feels like the behavior  
approach might be tidier since it keeps the logic closer to the  
objects themselves.

If I do switch to behaviors,  I'm not quite sure how to deal with the  
"local logic" I mentioned earlier.  If the behavior handlers pass the  
event, will it end up going to the instance of the object that  
initiated the event or will I have to use a different approach for that?

Seems like it might be a matter of programming style as much as  
anything else but I'm wondering what guidance there might be out there  
from people who've been using Rev for a lot longer than I have.


Pete Haworth

More information about the Use-livecode mailing list