Inheritance and Custom Properties

Dick Kriesel dick.kriesel at mail.com
Wed Apr 22 20:18:19 EDT 2009


On 4/21/09 3:38 AM, "David Bovill" <david.bovill at gmail.com> wrote:

> Actually you don't need to use "do' dick. One of the great things about
> custom properties is that you can do this:
> 
> put "test_Prop" into myCustomPropvar
>> put the myCustomPropvar of btn 1
>> 
> 
> You can also do this with params:  so in Dicks case
> 
> put pCustomPropertySetName & "[" & quote & pCustomPropertyName & quote & "]
>> into myCustomPropvar
>> put the myCustomPropvar of tRevObject into tValue
>> 

The first suggestion works, but not the second.  The second works too after
removing both occurrences of "& quote."

Thanks for the suggestions, David.

The new, improved function follows.

-- Dick

<postScript>
function effectiveValue
pCustomPropertyName,pCustomPropertySetName,pRevObject
   if pCustomPropertySetName is empty then
      put pCustomPropertyName into tProperty
   else
      put pCustomPropertySetName & "[" & pCustomPropertyName & "]" into
tProperty
   end if
   if pRevObject is empty then
      put long id of the target into tRevObject
   else
      put long id of pRevObject into tRevObject
   end if
   lock messages
   repeat until tRevObject is empty
      put the tProperty of tRevObject into tValue
      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>





More information about the Use-livecode mailing list