Inheritance and Custom Properties

David Bovill david.bovill at gmail.com
Wed Apr 15 11:12:53 EDT 2009


You'd have to set and retrieve the data yourself - I just put in commented
out pseudo code. So:

getprop porkNbeans
>     return the uData ["porkNbeans"] of me to someValue
> end porkNbeans
>
> setprop porkNbeans someValue
>     set the uData ["porkNbeans"] of me
> end porkNbeans
>

That  give you effective inheritance of the "porkNbeans" custom property. I
do this for pretty well every custom property now, because it makes it so
much easier to see what is going on by reading the script, and it tidies all
your messy custom properties into one easy to delete set. It also give you
"room to grow" as you may find you want to do other things while setting the
property - like turn the microwave on :)

2009/4/15 Jim Bufalini <jim at visitrieve.com>

> Hi David,
>
> While very useful message handlers, I don't believe that this qualifies as
> object inheritance. And I don't know that someone just starting to get
> their
> arms around custom properties should attempt to mess with them. ;-)
>
> For example, your setProp example doesn't have a pass statement, so the
> actual custom property won't get changed. Someone just starting out with
> custom properties wouldn't pick up on this and just think "things don't
> work." And there are issues of recursion if used improperly and it takes
> some understanding of sequencing.
>
> But, if Richmond decides to play with setProp and getProp and gets
> confused,
> you can answer his questions. ;-)
>
> Aloha from Hawaii
>
> Jim Bufalini
>
>
> > -----Original Message-----
> > From: use-revolution-bounces at lists.runrev.com [mailto:use-revolution-
> > bounces at lists.runrev.com] On Behalf Of David Bovill
> > Sent: Wednesday, April 15, 2009 1:59 AM
> > To: How to use Revolution
> > Subject: Re: Inheritance and Custom Properties
> >
> > 2009/4/15 Jim Bufalini <jim at visitrieve.com>
> >
> >
> > > Because they are not inherited, you are able to set them all
> > independently
> > > to different values, even though they all have the same names and
> > keys.
> >
> >
> > If you want them "inherited" you need to define a "getprop" handler.
> >
> > getprop porkNbeans
> > >      -- return your data here
> > > end porkNbeans
> > >
> > > setprop porkNbeans someValue
> > >      -- set your data here
> > > end porkNbeans
> >
> >
> > Put those anywhere in the hierarchy to "inherit" the property for all
> > objects below it in the message path. You can check for the type of
> > object
> > if you want to restrict the property to particular things.
> > _______________________________________________
> > use-revolution mailing list
> > use-revolution at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> > subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-revolution
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the use-livecode mailing list