Front scripts vs Behaviors

Peter Haworth pete at mollysrevenge.com
Wed Aug 11 13:01:05 EDT 2010


Thanks Mark.  I've read Richard's write up before, very useful.

Maybe if I explain a bit more what I'm trying to achieve.  I've  
written a development framework for my apps which serves as the  
interface between controls on cards and my sqlite database.  Groups on  
the card are tied to a db table and controls in the group are tied to  
columns in the table related to the group.  Every time the user  
modifies the content of a control, my frontscripts handle the updating  
of the database in handlers such as menuPick, closeField, etc.

Sometimes, a specific control may need some "local" logic to handle  
things it needs to do other than just updating the db (changing the  
contents of another field, recalculate totals, stuff like that).  The  
front script handlers pass their respective messages on so I can write  
that "local" logic as a handler for that specific instance of that  
type of control.

If I switch over to behaviors (and I'm inclined to do that)  I need a  
way to handle this "local" logic since, as you say, the messages wont;  
ever make it to the actual control, but I still need the database  
update to occur in the behavior.  I'm thinking perhaps if I have  
handlers in the controls themselves named something like  
"localMenuPick" or something similar then have the behavior menuPick  
handler send/dispatch a localMenuPick messge to the control, that  
might work?

Pete


On Aug 11, 2010, at 8:12 AM, use-revolution-request at lists.runrev.com  
wrote:

> Message: 27
> Date: Tue, 10 Aug 2010 22:10:09 -0700
> From: Mark Wieder <mwieder at ahsoftware.net>
> Subject: Re: Front scripts vs Behaviors
> To: How to use Revolution <use-revolution at lists.runrev.com>
> Message-ID: <136648291062.20100810221009 at ahsoftware.net>
> Content-Type: text/plain; charset=us-ascii
>
> Peter-
>
> Check out Richard Gaskin's writeup on the message path:
>
> http://www.fourthworld.com/embassy/articles/revolution_message_path.html
>
> Behavior objects are not at all like frontscripts, but are more like
> local backscripts. That said, it sounds from your description that
> behaviors fit your purposes more than the use of frontscripts does.
>
> You wouldn't normally pass a message on after a behavior button has
> handled it (or not) because it would be at the end of the message
> path. Behavior objects also allow you to override a default behavior
> when desired.
>
> -- 
> -Mark Wieder
> mwieder at ahsoftware.net




More information about the use-livecode mailing list