Inheritance and Custom Properties
jim at visitrieve.com
Wed Apr 15 17:28:17 EDT 2009
Dear Dick and David,
I don't want to be a stickler here and keep this going on forever, ;-) but I
believe the correct answer to "Are *custom* properties inherited?" Has to be
While it is 100% true that handlers like setProp can be used by the
application programmer to review, copy, alter and even deny a change of one
custom property to others, this is not inheritance. And, of course, you can
write custom handlers like Dick's. But again, this is not true inheritance.
To me, the definition of "inheritance" is that, on the creation of an
object, it "automatically" assumes characteristics of another object. Or on
change of a property of one object, its dependent objects' properties
"automatically" change. The key here is "automatic," and not that "I can
program it. ;-)"
So for example, if you check the *Purge stack on close" of a main stack,
then any existing substacks, or any newly created substacks, will
"automatically" have this property checked. If you then uncheck this
property (or set it in code), in either the main stack or any of its
substacks, all related stacks "automatically" reflect the change and this
property is unchecked. You don't have to program this. And, in fact, you
cannot program against this inheritance.
This simply does not "automatically" happen with custom properties. (Now
please don't point out that if you set the custom properties of a
templateStack, a newly created stack will have those custom properties. ;-)
Hence, custom properties are not inherited in the traditional sense. ;-)
Aloha from Hawaii,
> -----Original Message-----
> From: use-revolution-bounces at lists.runrev.com [mailto:use-revolution-
> bounces at lists.runrev.com] On Behalf Of Dick Kriesel
> Sent: Wednesday, April 15, 2009 7:06 AM
> To: use-rev
> Subject: Re: Inheritance and Custom Properties
> On 4/15/09 4:58 AM, "David Bovill" <david.bovill at gmail.com> wrote:
> > If you want them "inherited" you need to define a "getprop" handler.
> You can inherit any custom property even without getprop handlers, by
> walking through the object's long id until you find a value.
> Here's a function that does that for any given custom property name,
> optionally any given custom property set name as well.
> If you're interested in a similar function that identifies the object
> provided the effective value, let me know.
> As usual, watch out for line wraps imposed by email.
> -- Dick
> function effectiveValue pCustomPropertyName,pCustomPropertySetName
> put long id of the target into tRevObject
> if pCustomPropertySetName is empty then
> put "put the" && pCustomPropertyName && "of tRevObject into tValue"
> put "put the" && pCustomPropertySetName & "[" & quote &
> pCustomPropertyName & quote & "] of tRevObject into tValue" into
> end if
> lock messages
> repeat until tRevObject is empty
> do tStatement
> if tValue is empty then
> if word 1 of tRevObject is "stack" then
> delete word 1 to 3 of tRevObject
> delete word 1 to 4 of tRevObject
> end if
> exit repeat
> end if
> end repeat
> unlock messages
> return tValue
> end effectiveValue
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
More information about the use-livecode