setprop handlers for custom property sets

Peter Haworth pete at lcsql.com
Thu Jul 30 18:29:31 EDT 2015


I wonder if the mouseUp script is - set the mySet["myNumber"] of me to 90 -
whether the setProp handler for myNumber still is executed.



On Thu, Jul 30, 2015 at 3:22 PM Paul Dupuis <paul at researchware.com> wrote:

> 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.
>
> Thanks.
>
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the Use-livecode mailing list