Storing Scripts

andu undo at cloud9.net
Wed Dec 5 02:42:01 EST 2001


Matt Denton wrote:
> 
> Hi List,
> 
> I'm trying to work out a way to create a central place to store a series
> of handlers specific to a type of field I have created: the field simply
> automatically opens to the maximum depth, resizes when typed in, and
> closes when you leave the field.
> 
> My first idea was to place the handlers in a group.  No good, placed
> other 'group movent' restrictions, but kind of right idea.
> 
> Next idea was in the card Script.  No good, this would trap field events
> (openField etc) for fields that I didn't want trapped.
> 
> Next idea: Insert Script command. Again trapped events for fields that I
> didn't want trapped.
> 
> Of course I could write:
> 
> on openField
>         goDoSomething
> end openField
> 
> on closeField
>         goDoSomethingElse
> end closeField
> 
> etc
> 
> but that would mean updates would require adding to every single field.
> So is there a way to say:
> 
> "send all messages for this field to this script".
> 
> ... sort of an insert script command but at an object level.  I'm sure
> this OO scenario has been worked out, I just don't know how to do it
> yet.. oui [ ] non [ ]?  Group scripts exhibit this behavior; just need a
> group script that doesn't group the object's movement.
> 
> Any help would be appreciated.

This was just discussed in the past few days: Put all handlers in the
stack or card script and specify in them what action to trigger
depending on object name.

on openField
switch the short name of the target
case "field1"
do_some_stuff #specific for field "field1"
break
case "field2"
do_other_stuff #specific for field "field2"
break
#...and so on...
end switch
end openField

> 
> Thanks
> 
> Matt Denton
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution

-- 
__________________________
 Regards, Andu



More information about the use-livecode mailing list