Adding Objects To Groups
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 77
- Joined: Thu May 21, 2015 2:41 am
Adding Objects To Groups
I'd like to add an object to an existing group without ungrouping and regrouping. Any way to do that?
Re: Adding Objects To Groups
It can certainly be done.
There are many ways to do it.
You can use the project browser and drag & drop the object into the required group for one method.
You can also add an object to group via script.
There are many ways to do it.
You can use the project browser and drag & drop the object into the required group for one method.
You can also add an object to group via script.
-
- Posts: 77
- Joined: Thu May 21, 2015 2:41 am
Re: Adding Objects To Groups
I guess I didn't specify. I need to add it to the group using script from the button creating the object.
Re: Adding Objects To Groups
If you want to add it to a group whilst creating the object it's quite simple.
Fore example creating a button in group test using script as per below.
on mouseUp
create button "button_name" in grp "test"
end mouseUp
Fore example creating a button in group test using script as per below.
on mouseUp
create button "button_name" in grp "test"
end mouseUp
-
- Posts: 77
- Joined: Thu May 21, 2015 2:41 am
Re: Adding Objects To Groups
...well now I feel silly. I should tried that. Thanks!
-
- VIP Livecode Opensource Backer
- Posts: 9660
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Adding Objects To Groups
Hi all.
Craig Newman
There are 2000-odd native words in the dictionary. It may not have been obvious that there was such a command as "create", nor that it contains within it the ability to target a group as a destination. As in learning any language, it takes time to get a decent vocabulary. That is why we have this forum...well now I feel silly. I should tried that
Craig Newman
Re: Adding Objects To Groups
dunbarx wrote:Hi all.
There are 2000-odd native words in the dictionary. It may not have been obvious that there was such a command as "create", nor that it contains within it the ability to target a group as a destination. As in learning any language, it takes time to get a decent vocabulary. That is why we have this forum.
Craig Newman
That is without a doubt the best response to this type of post I have ever seen. It made me feel better for having similar questions.
Thank you.
-
- Posts: 77
- Joined: Thu May 21, 2015 2:41 am
Re: Adding Objects To Groups
Ok I'm going to try resurrecting this post. How do you add an object to group using script outside of creating the button within the said group?
-
- VIP Livecode Opensource Backer
- Posts: 9834
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Adding Objects To Groups
In the Dictionary, for creating new objects see the "create" command, or for copying existing objects into a group see the "copy" command.Not a lot of thought wrote:Ok I'm going to try resurrecting this post. How do you add an object to group using script outside of creating the button within the said group?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- Posts: 77
- Joined: Thu May 21, 2015 2:41 am
Re: Adding Objects To Groups
I can't just add an object to a group, it must be copied to that group? Wouldn't that then require me to delete the original control?
-
- VIP Livecode Opensource Backer
- Posts: 9834
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Adding Objects To Groups
To create use "create".Not a lot of thought wrote:I can't just add an object to a group, it must be copied to that group? Wouldn't that then require me to delete the original control?
For copy use "copy".
To change the layer of a control set its "layer" property, with the "relayerGroupedControls" global property set to true while you do it.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 9660
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Adding Objects To Groups
Hi again.
I think so. You can move a control out of a group by changing its layer. But you cannot insert a control into a group by the same means, interspersing its layer.
You can create a new control into a group, or you can copy a control into a group, but you cannot insinuate a control into a group.
Or am I wrong? Anyone?
Craig
Code: Select all
Wouldn't that then require me to delete the original control?
You can create a new control into a group, or you can copy a control into a group, but you cannot insinuate a control into a group.
Or am I wrong? Anyone?
Craig
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: Adding Objects To Groups
Hi Craig,
We have to know the layer of the first and last control of the target group and we can set the layer of a control
between this two layers.
Don't forget
Best regards
Jean-Marc
Yes we can.but you cannot insinuate a control into a group
We have to know the layer of the first and last control of the target group and we can set the layer of a control
between this two layers.
Don't forget
Code: Select all
set the relayerGroupedControls to true
Jean-Marc
https://alternatic.ch
-
- VIP Livecode Opensource Backer
- Posts: 4000
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: Adding Objects To Groups
Hi all,
if you want to move a control within a group to the top you can do this:
if you want to move a control to the lowest layer within a group do this
Just be careful, if the layer number is wrong you can "layer" the control out of the group.
Kind regards
Bernd
if you want to move a control within a group to the top you can do this:
Code: Select all
on mouseUp
put the layer of group 1 into tLayerNo -- group layer is always the lowest layer of the group
put the number of controls of group 1 into tControlCount
put tLayerNo + tControlCount into tTopLayer -- layer of group plus the number of the controls of the group is the topLayer within the group
set the relayerGroupedControls to true
set the layer of field "myField" of group 1 to tTopLayer
set the relayerGroupedControls to false
end mouseUp
Code: Select all
on mouseUp
put the layer of group 1 into tLayerNo -- group layer is always the lowest layer of the group
set the relayerGroupedControls to true
set the layer of field "myField" of group 1 to tLayerNo + 1 -- this is the lowest layer within the group
set the relayerGroupedControls to false
end mouseUp
Kind regards
Bernd
-
- VIP Livecode Opensource Backer
- Posts: 9660
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Adding Objects To Groups
Ah, the reLayerGroupControls.
I forgot about that. From the dictionary:
Craig
I forgot about that. From the dictionary:
Right.Important! It is not possible for other controls to be interspersed between the controls in a single group, so changing a grouped control's layer may change its group membership if the relayerGroupedControls is true:
* You can move a control out of a group by setting the control's layer to a number greater than the topmost control in the group, or less than the bottom-most control in the group.
* Conversely, you can move a control into a group by setting the control's layer to a number between the bottom-most and topmost controls in the group.
Craig