Why does this not work ?

Mark Waddingham mark at livecode.com
Tue Jun 11 02:32:21 EDT 2019


On 2019-06-11 02:44, Alex Tweedly via use-livecode wrote:
>> on mouseup
>>    local tName, t1, t2
>>    put the long name of fld "F" into tName
>>    put tName & ",12,13" into t1
>>    put "t1" && t1 &CR after msg
>> 
>>    put item 1 of t1 into t2
>>    set the vis of t2 to TRUE
>>    put "t2 was OK" &CR after msg
>> 
>>    set the vis of (item 1 of t1) to TRUE
>>    put "using parens OK" &CR after msg
>> 
>>    set the vis of item 1 of t1 to TRUE       -- this line fails !!
>>    put "here" &CR after msg
>> 
>> end mouseup
> that line fails, with the error message
> 
>> button "Button": execution error at line 14 (Chunk: error in object 
>> expression) near "field "F" of group id 1005 of group id 1007 of card 
>> id 1002 of stack "/Users/alextweedly/Dropbox 
>> (Personal)/Apps/objectchunk.livecode"
>> 
> 
> I just cant see why that doesn't work :-)
> 
> If I use parentheses, or if copy the first item over to a different
> variable), then it is all OK. But doing it directly (AFAICT) should
> work, and doesn't. What am I misunderstanding ?

The engine assumes that if you are manipulating a property of a string 
chunk, then you want to manipulate the part of the target object the 
string chunk describes, and not dereference the chunk as an object to 
set the property on.

i.e. in the case above the failing line is attempting to set the visible 
property of the first item of the content of control referenced with 
chunk "<long name>,12,13" -- and the latter is not a valid control 
chunk.

Warmest Regards,

Mark

-- 
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps




More information about the use-livecode mailing list