Inheritance and Custom Properties
François Chaplais
francois.chaplais at mines-paristech.fr
Mon Apr 20 12:26:50 EDT 2009
Le 15 avr. 09 à 19:05, Dick Kriesel a écrit :
> 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,
> and
> optionally any given custom property set name as well.
>
> If you're interested in a similar function that identifies the
> object that
> provided the effective value, let me know.
>
> As usual, watch out for line wraps imposed by email.
>
> -- Dick
>
> <postScript>
>
> 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" into
> tStatement
> else
> put "put the" && pCustomPropertySetName & "[" & quote &
> pCustomPropertyName & quote & "] of tRevObject into tValue" into
> tStatement
> 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
> else
> delete word 1 to 4 of tRevObject
> end if
> else
> exit repeat
> end if
> end repeat
> unlock messages
> return tValue
> end effectiveValue
>
> </postScript>
>
but you do use the "do" command...
I implemented years ago some OOP behaviour for Rinaldi's "textoid" HC
external, with the goal of having an as flexible as possible text
window management. But I had to use the "do" command, because I
basically had to implement an custom interpreter over hypertalk.
best regards,
François
More information about the use-livecode
mailing list