Using polygon as line and childControlNames

Geoff Canyon gcanyon at gmail.com
Sun Dec 7 14:20:46 EST 2014


On Sun, Dec 7, 2014 at 4:17 AM, Terence Heaford <t.heaford at btinternet.com>
wrote:

> There seems to be a bug with childControlNames in LC 7.0.1(RC3) as it all
> works correctly in LC 6.7.1(RC3).
>

I think perhaps your code is taking advantage of a quirk in LC. If you
don't give an object a name, the childcontrolnames returns something like
this:

graphic id 1011

If that is in a variable tObject, then a statement like this will work:

            delete tObject

But if you name an object, say "bob", then the childcontrolnames will
simply return "bob" and the delete will fail with a bad reference.

This works:

on test
   drawLine 10,10,(50+random(50)),(50+random(50)),"red"
   wait 2 seconds
   deleteChart
end test

on drawLine x,y,x1,y1,tColor
   lock screen
   create grc in me
   put the long id of the last grc of me into tID
   set the style of tID to polygon
   set the foregroundColor of tID to tColor
   set the points of tID to x,y & cr & x1,y1
   unlock screen
end drawLine

on deleteChart
   lock screen
   repeat for each line tID in the childControlIDs of me
      delete control id tID of me
   end repeat
   unlock screen
end deleteChart



More information about the use-livecode mailing list