Adding items to a group using code

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
andyh1234
Posts: 476
Joined: Mon Aug 13, 2007 4:44 pm
Contact:

Adding items to a group using code

Post by andyh1234 » Wed May 28, 2008 3:35 pm

Another question im afraid - sorry!

I have an existing group, Id like to create some more rectangles using code (easy enough), but then put the rectangles in an existing group.

The code im using to create the rectangles is...

set the style of the templategraphic to rectangle
set the name of the templategraphic to "test"
set the left of the templategraphic to 0
create graphic

What would I need to add to make the new rectangle be part of an existing group called 'grpBack', or is it just best to kill the old group and recreate it with the group command?

Thanks

Andy

Klaus
Posts: 14206
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Wed May 28, 2008 3:55 pm

Hi Andy,

you are almost there:

Code: Select all

...
set the left of the templategraphic to 0 
create graphic in grp "name of grp here"
...
:-)


Best

Klaus

andyh1234
Posts: 476
Joined: Mon Aug 13, 2007 4:44 pm
Contact:

Post by andyh1234 » Wed May 28, 2008 6:01 pm

Thanks Klaus!

Andy

Post Reply