Accessing array custom properties
craig at starfirelighting.com
Tue Oct 26 09:13:03 EDT 2021
An array variable is just a variable, it is not a property. You cannot “make” one into the other.
So, basically, put the pArrayName[pElementName] of button “button” is just syntax that does not exist in the lexicon, for the above reason.
> On Oct 25, 2021, at 11:18 PM, Neville Smythe via use-livecode <use-livecode at lists.runrev.com> wrote:
> Is there a logic behind the following?
> I want the values of a custom property which is an array: to take a specific example the dropShow of button “button” and I want the specific element color
> Of course I can write: put the dropShadow of button “button” into aa; put aa[color]
> Conveniently there is a shortcut : put the dropShadow[color] of button “button”
> (which I guess would need special coding because there isn’t a property whose name is "dropShadow[color]”; and this doesn’t work for DataGrids - but that’s another question)
> Now I want to use variables so I can script for different properties
> put “color” into pElementName; put “dropShadow” into pArrayName
> 1. This works: put the dropShadow of button “button” into aa; put aa[pElementName]
> 2. And this works: put the pArrayname of button “button” into aa; put aa[pElementName]
> 3. And (conveniently) this works: put the dropShadow[pElementName] of button “button”
> 4. BUT (annoyingly) this fails, giving an empty result: put the pArrayName[pElementName] of button “button”
> Why? If 3 works, I would have thought the parser would substitute values for all variables before getting the property using the “special coding”
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the use-livecode