Adding an object to an existing group

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
exheusden
Posts: 170
Joined: Fri Oct 09, 2009 5:03 pm
Contact:

Adding an object to an existing group

Post by exheusden » Sat Sep 01, 2012 4:34 pm

I have a group of nine buttons. I now wish to add a tenth button to the group. I have tried ungrouping, placing the button, selecting all ten and grouping, but the group properties still only shows 9 elements and the new button does not cause the group script to run.

How can I add another button to a pre-existng group of buttons?

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Re: Adding an object to an existing group

Post by bn » Sat Sep 01, 2012 5:03 pm

Hi,

you have several options:
manually you can cut the button from the card. Select the group and go into group editing. Paste the button. The button is now member of the group.
By script you can do it this way:

Code: Select all

on mouseUp
   put the layer of group "myGroup" into tLayer
   set the relayerGroupedControls to true
   set the layer of button "myButton" to tLayer +1
   set the relayerGroupedControls to false
end mouseUp
Kind regards
Bernd

exheusden
Posts: 170
Joined: Fri Oct 09, 2009 5:03 pm
Contact:

Re: Adding an object to an existing group

Post by exheusden » Sat Sep 01, 2012 5:26 pm

Cutting and pasting the button doesn't work. The group remains with just the nine original members. This is what I tried to explain in my first post: " I have tried ungrouping, placing the button, selecting all ten and grouping…" Perhaps there's a step I'm missing something in the GUI. The only way I was able to do it was through the message-box, with create button "Help init" in group "Templates".

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Re: Adding an object to an existing group

Post by bn » Sat Sep 01, 2012 5:31 pm

Cutting and pasting the button doesn't work. The group remains with just the nine original members
It works for me. Did you go into editing mode for the group before pasting?

Kind regards
bernd

exheusden
Posts: 170
Joined: Fri Oct 09, 2009 5:03 pm
Contact:

Re: Adding an object to an existing group

Post by exheusden » Sat Sep 01, 2012 6:00 pm

I expect I didn't. I shall try that. Many thanks.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10324
Joined: Wed May 06, 2009 2:28 pm

Re: Adding an object to an existing group

Post by dunbarx » Sat Sep 01, 2012 6:13 pm

Another option:

copy "yourButton" to group "yourGroup"

Craig Newman

Post Reply