using arrays in custom properties

David Epstein depstein at att.net
Mon Mar 10 19:27:00 EST 2003


The first comments on this question puzzled me, as they involved setting
custom property SETS, whereas the question seems only to deal with custom
properties themselves.  I may be missing something, but most of the commands
quoted below cause an error in MC 2.4 because they try to "put" xxx into a
custom property rather than "set" the custom property to xxx.  To empty any
of the elements of the array that it has been "set" to, the property should
be written to a variable, the adjustments made in that variable, and then
the property "set" to the value of the variable.

e.g., 

put the specialPrices of btn "PriceChecker" into holder
delete holder["Apples"]
put "5.50" into holder["Potatoes"]
set the sepcialPrices of btn "PriceChecker" to holder

Does this do the job?

David Epstein



> I'm storing an array in a custom property of an object.  Storing and
> retrieving items is fine.  But I'm having no luck wiping them.
> 
> Let's say that I've got a price list object, and I want to have a custom
> property array linking 'specials' to their special prices.  One day fruit is
> on special offer:
> 
> put "23.99" into the specialPrices["Bananas"] of btn "PriceChecker"
> put "9.99" into the specialPrices["Apples"] of btn "PriceChecker"
> 
> The next day, vegetables are on offer:
> 
> put "5.50" into the specialPrices["Potatoes"] of btn "PriceChecker"
> put "5.99" into the specialPrices["Turnips"] of btn "PriceChecker"
> 
> Now if I inspect the custom property 'specialPrices', it has all four items
> listed, when I really only wanted the most recent two.
> 
> I want a way that I can start afresh, without caring what went before.  If
> specialPrices was a global variable, I can wipe out the array by doing:
> put empty into specialPrices
> 
> or even
> delete variable specialPrices
> 
> How can I do something similar in the case of a customProperty which is an
> array?




More information about the use-livecode mailing list