how to get the value of a custom property if the name of the cProperty is in a variable?
mark at livecode.com
Wed Aug 2 17:36:52 EDT 2017
You can put the name of the property into a local var and use that (unless I misunderstood the problem).
Ali's suggestion is however the very pragmatic one - there are always going to be cases where var names might conflict with other things 'in context' and require disambiguation. (Although even that doesn't work in some cases - consider 'tExt' - when you have case insensitivity and no need to explicitly declare variables).
Of course, if you'd like to file a bug report / enhancement about being able to do 'the "mycustompropname" of ... - then that is probably the 'future' much better solution :)
Sent from my iPhone
> On 2 Aug 2017, at 21:56, Dr. Hawkins via use-livecode <use-livecode at lists.runrev.com> wrote:
> On Wed, Aug 2, 2017 at 10:25 AM, Klaus major-k via use-livecode <
> use-livecode at lists.runrev.com> wrote:
>> answer the tMyVar of this cd
> This is an area that is awkward in live code.
> The use of unquoted literals for this is inconsistent with most of live
> code (but quoting would be inconsistent with the built in properties, so .
> . .)
> I have "loops" like
> repeat for each word someProp in "theOnlyPropInTheList"
> set the someProp of someControl to myVal
> end repeat
> If you have a variable whose name is the same as the property, there does
> does not seem to be a good solution.
> Dr. Richard E. Hawkins, Esq.
> (702) 508-8462
> 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