Cloning Groups / Images

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
cruddydan
Posts: 15
Joined: Tue Jan 18, 2011 10:57 pm

Cloning Groups / Images

Post by cruddydan » Sat Jan 22, 2011 4:34 am

I have 2 cards in my stack: "Main" and "Images". I have put some groups, which contain images, onto the "Images" card. From script, I want to copy those groups onto the "Main" card. I am able to Clone the groups successfully, but the clones show up on the "Images" card. How do I get the cloned groups to the "Main" card?

kray
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 56
Joined: Sat Apr 08, 2006 5:28 pm
Contact:

Re: Cloning Groups / Images

Post by kray » Sat Jan 22, 2011 9:11 am

cruddydan wrote:I have 2 cards in my stack: "Main" and "Images". I have put some groups, which contain images, onto the "Images" card. From script, I want to copy those groups onto the "Main" card. I am able to Clone the groups successfully, but the clones show up on the "Images" card. How do I get the cloned groups to the "Main" card?
The following assuues you have a group with images on the "Images" card named "myGroup":

Code: Select all

copy group "myGroup" of card "Images" to card "Main"
Ken Ray
Sons of Thunder Software
Email: kray@sonsothunder.com
Web site: http://www.sonsothunder.com

cruddydan
Posts: 15
Joined: Tue Jan 18, 2011 10:57 pm

Re: Cloning Groups / Images

Post by cruddydan » Sun Jan 23, 2011 8:34 am

That worked fine, kray, except that the new group "MyGroup" on card "Main" does not respond to any mouse or touch events. I can see new group, but my mouseDown script (which is in the stack) doesn't execute when I click on the new group. I know the mouseDown script works because it fires when I click a button on "Main".

Do groups not respond to "clicks"? Is there some property to make the group "clickable"?

kray
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 56
Joined: Sat Apr 08, 2006 5:28 pm
Contact:

Re: Cloning Groups / Images

Post by kray » Sun Jan 23, 2011 3:39 pm

Groups do not respond to mouse events unless you are clicking on some other object inside the group (in which case the target object will get the event and if it is not handled by the target object then the group gets a shot at it).

The way to fake it is to make a transparent button inside the group that is the same size as the group (minus any margins), with no script of its own so the group will get the event.
Ken Ray
Sons of Thunder Software
Email: kray@sonsothunder.com
Web site: http://www.sonsothunder.com

Post Reply