[Tip] Propeties & sets & List of 'reserved words' and gotchas
Trevor DeVore
lists at mangomultimedia.com
Mon Feb 20 16:30:25 EST 2006
On Feb 20, 2006, at 1:02 PM, Stephen Barncard wrote:
> I've been working a lot with Custom Properties lately and have come
> across an undocumented system condition that's taken a while for me
> to find out about....so I'll pass it along.
>
> I say 'condition' because I think this is normal behavior for the
> custom property system. But it's a GOTCHA for sure.
>
> The rule is:
>
> One can't name a custom property with the same name as any regular
> property of an object.
>
> One should not probably name any object with any system reserved
> words, even if it might work sometimes....
>
> when you try to name a property like this:
>
> set the AnyPropName[name] of this stack to "anytext"
>
> it won't work or will provide unpredictable results. When one
> tries to read it, one just gets the name of the stack, and
> sometimes stacks get renamed, etc... Bad stuff happens..
>
> So this might happen if one has a user naming properties directly.
>
> If one has custom property naming directly open to users, one
> should run a check on the entry compared against the properties()
> of that object.
Stephen,
You can reliably use reserved words with array notation as long as
you have quotes around the key (I've never tried without quotes
actually).
I use code like this all of the time:
set the uAutoEvents["MouseUp"] of myObject to "DoSomething"
Perhaps it is the lack of quotes that is causing problems?
--
Trevor DeVore
Blue Mango Multimedia
trevor at mangomultimedia.com
More information about the use-livecode
mailing list