Inheritance and Custom Properties
David Bovill
david.bovill at gmail.com
Thu Apr 16 11:48:32 EDT 2009
2009/4/16 Mark Wieder <mwieder at ahsoftware.net>
> David-
>
> Wednesday, April 15, 2009, 4:58:58 AM, you wrote:
>
> > If you want them "inherited" you need to define a "getprop" handler.
>
> Unfortunately, it seems that behavior controls are the exception to
> this. Placing the getprop handler in a behavior button does not
> implement inherited custom properties, while placing them in the stack
> script does.
Really ??? I haven't come across that! Are you sure? So far everything
behaves :) as expected. Behaviors are inserted in the message path and
everything below this will inherit the behavior. this is not the same for
the stack - unless you attached the behavior to the stack which would be a
bit odd... if you've got an example let us in...
...and note that you probably don't want to inherit the setprop
> handler: changing the value of the custom property in a child object
> would change the value for all objects that inherit that property.
That all depends on how you write the getprop / setprop - the important
thing is to keep them symetrical. If you want a global inherited property
then you can have that with the examples I gave earlier. If you want a
property that apples to each object, but can have individual instance values
then you can get and set a custom property of the target to achieve that -
putting something like this in the stack script would achieve that (you'd
want to do something more interesting in a real world example):
getprop instance_Property
> return the uOPN ["instance_Property"] of the target
> end instance_Property
Of course you can get-and-set the data from anywhere - a text file or
database... its up to you if you associate it with the target, the card, the
stack, or globally etc
More information about the use-livecode
mailing list