How can a button not have properties?

Mark Schonewille m.schonewille at economy-x-talk.com
Sun Oct 25 15:37:14 EDT 2015


Hi Ali,

Perhaps it would be possible to add a few lines to the parser, which 
would make it possible to run syntax like

put (the cSomeProperty of this card)["some index"] into myVar

The parentheses would indicate that additional parsing is necessary, 
while nothing would need to happen without parentheses.

I.e. any property in parentheses should also be available as an array, 
but a property that is not in parentheses stays a property as in the 
current situation.

Another option would be to create an additional array() function, which 
works either like an in-line split or as a way to convert a property to 
an array:

put array(the cSomeProperty of this card)["some index"] into myVar
put array("a,b,c,d,e,f",comma,"")[1] into myVar --> myVar = a

On the other hand, we still have the customProperties and 
customPropertySet properties, which allow you to do exactly the same, 
although the notation is different and I believe they don't allow 
multidimensional arrays.

on mouseUp
    put 1 into myData["cProp1"]
    put 2 into myData["cProp2"]
    set the customProperties["someProp"] of me to myData
    set the customPropertySet of me to "someProp"
    put the cProp2 of me
end mouseUp


Mark Schonewille
http://economy-x-talk.com

Buy the most extensive book on the
LiveCode language:
http://livecodebeginner.economy-x-talk.com

Op 10/23/2015 om 23:24 schreef Ali Lloyd:
> I wonder if this is something we can fix. At the moment "the keys" is
> hard-coded to allow the drag/clipboard data properties as source arrays.
>
> There's probably a parsing ambiguity involved in having an object property
> source that is not currently obvious to me.
>
> On Fri, Oct 23, 2015 at 10:15 PM Ali Lloyd <ali.lloyd at livecode.com> wrote:
>
>> Indeed, or you can force evaluation to an array using brackets.
>>
>> put the keys of (the properties of btn "File" of grp "mcp_menu" of  cd 1 of
>> stack "old_cp")
>>
>> On Fri, Oct 23, 2015 at 10:09 PM Mark Schonewille <
>> m.schonewille at economy-x-talk.com> wrote:
>>
>>> Hi,
>>>
>>> Actually, a property isn't an array. You have to put the properties
>>> property into a variable to make it an array.
>>>
>>> Mark Schonewille
>>> http://economy-x-talk.com
>>>
>>> Buy the most extensive book on the
>>> LiveCode language:
>>> http://livecodebeginner.economy-x-talk.com
>>>
>>> Op 10/23/2015 om 23:07 schreef Dr. Hawkins:
>>>> On Fri, Oct 23, 2015 at 1:53 PM, Peter Haworth <pete at lcsql.com> wrote:
>>>>
>>>>> The properties property is an array so a simple put will not display
>>>>> anything.
>>>>>
>>>> Yes, but
>>>>
>>>> put the keys of the properties  of btn "File" of grp "mcp_menu" of  cd
>>> 1 of
>>>> stack "old_cp"
>>>>
>>>>
>>>>
>>>> also comes up empty.
>>>>
>>>> I found this when setting the properties of one button to that of
>>> another;
>>>> a line of code that got used for a year or so on every single version
>>>> change.  It bombs out of the script with only an error in the message
>>> box.
>>>>
>>>>
>>>
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list