using arrays in custom properties

Ben Rubinstein benr_mc at cogapp.com
Mon Mar 10 08:18:01 EST 2003


Jan,

Thanks for this.

To summarise, what it amounts to is that given an array custom property
called "x", to be reinitialised,
    - set the customPropertySet of the object to "x"
    - create a new array
    - set the customProperties of the object to the new array
    - set the customPropertySet of the object to empty

At the end of this switcheroo, the old array that was the "x" property of
the object has been deleted, and replaced with the new one.  Wacky!

I guess this is almost too obscure to be in the Cookbook - but perhaps it
could be appended to the "How to... delete a custom property" article.

Since sending my message, and before receiving yours, I did at least find
(by digging into the revPropertiesPalette scripts) how to get the keys of a
custom property array.  The answer is that 'customKeys' can be used in an
array syntax, so that whereas
    the customKeys of btn "PriceChecker"

returns the keys of the current custom property set (that is, the names of
the non-array custom properties);

    the customKeys["specialPrices"] of btn "PriceChecker"

returns the keys of the array custom property 'specialPrices'.  I don't
believe this is documented (at least not in the 'customKeys' entry in the
Transcript Dictionary) - that would definitely be reasonable.

Thanks again,
 
  Ben Rubinstein               |  Email: benr_mc at cogapp.com
  Cognitive Applications Ltd   |  Phone: +44 (0)1273-821600
  http://www.cogapp.com        |  Fax  : +44 (0)1273-728866




More information about the use-livecode mailing list