setprop handlers for custom property sets

Paul Dupuis paul at
Thu Jul 30 18:21:46 EDT 2015

On 7/30/2015 5:31 PM, Mark Wieder wrote:
> Within the customPropertySet you just have:
> setProp property1 pValue
>   set the property1 of me to pValue
> end property1
> setProp property2 pValue
>   set the property2 of me to pValue
> end property2

Thanks Mark. I am interested in avoiding the array notation with my
setProp and getProp.

I just was having trouble figuring out exactly what the coding should
be. I now understand that if I have a custom property set for a stack
called "mySet" and property in mySet called "myNumber"

So if I want a setProp handler to calculate myNumber as the parameter
div 100 - for example to convert a percent to a decimal number -  in a
stack script:

setProp myNumber pValue
  set the myNumber of me to pValue / 100
end myNumber

if I then execute in a button script

on mouseUp
  set the customPropertySet of this stack to "mySet"
  set the myNumber of me to 90
  set the customPropertySet of this stack to empty
end mouseUp

it does correctly execute the setProp handler. Much to my surprise. This
implies that you can NOT have two custom property sets that have the
same property name IF you want to use setprop or getProp handlers with them.


More information about the Use-livecode mailing list