Still a beginner who doesn't know how to make a 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: Klaus, FourthWorld, heatherlaine, kevinmiller

CAsba
Posts: 452
Joined: Fri Sep 30, 2022 12:11 pm

Re: Still a beginner who doesn't know how to make a group.

Post by CAsba »

I've tried following instructions to set up a group; I tried doing it via code in message box and I tried selecting each control. Neither produced a group. I really need a click by click instruction to set it up.
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10507
Joined: Wed May 06, 2009 2:28 pm

Re: Still a beginner who doesn't know how to make a group.

Post by dunbarx »

CAsba.

1- On a new card make three radio buttons. Select all three. Click on the "Group" menu in the LC menubar.

2- Delete the group you made above. Make three new buttons. In the message box: "group btn 1 and btn 2 and btn 3"

That will at least get you started.

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

Re: Still a beginner who doesn't know how to make a group.

Post by Klaus »

Hi CAsba,

do this:
1. Select the first of your controls you want to group.
2. Hold the shift-key and click the next control, now two controls are selected.
3. Do this for the rest of your controls
4. Now all controls that you want to group are selected.
5. LC menu: Object -> Group selected (CMD-G)
6, Give your new group a name and that's it!

If you want to do thos via script, do this:

Code: Select all

...
set the selected of fld "lastselection" to TRUE
set the selected of fld "lastselection2" to TRUE
set the selected of btn "Start again" to TRUE
set the selected of btn "go back" to TRUE
set the selected of grc "Rectangle" to TRUE
## Now all of your objects are selected, now:
group
## Done! :-)
## Deselect the controls:
select empty
...
Now you can copy that group to wherever you want to:

Code: Select all

...
copy grp "name of your group" to cd 42 of stack "another stack"
...
Hope that helps!

Best

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

Re: Still a beginner who doesn't know how to make a group.

Post by dunbarx »

CAsba.

Your new groups can be managed just like any other control. A group is just a control that contains other controls. You can name your group, change its dimensions (something you might play with, since that takes some time to get used to as regards the members of the group) and all the other typical things that controls have and can do.

Groups do have their own particular properties. These are good things, but you have to learn about them.

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

Re: Still a beginner who doesn't know how to make a group.

Post by dunbarx »

CAsba

I see from Klaus other methodologies, and in LC, we know there are many ways to do things.

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

Re: Still a beginner who doesn't know how to make a group.

Post by dunbarx »

CAsba

Once you have your group, play with it. Especially play with the "Select Grouped" (a terrible name) menu in the LC menubar. This allows you to toggle between having the child controls selectable individually, or to be "held" entirely in the group.

So hilite that menu. Now you can move one of your child controls around the card. If you then click on that button again, you will see that the group has reformed, and also resized itself to accommodate the locs of all the children.

Play. Write back when you have been able to add another control to your existing group.

Craig
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10430
Joined: Fri Feb 19, 2010 10:17 am

Re: Still a beginner who doesn't know how to make a group.

Post by richmond62 »

This point is slightly off-topic, but I do believe is useful to know:

If you group several objects and then give that group a name, then, at a later date, ungroup the group, that group continues to 'exist' even though it no longer contains the objects it previously contained.

So, if you, subsequently, group another set of objects they will be grouped into the previous group:

Here is a pictorial demo of this slightly annoying phenomenon.

Here I have 2 sets of buttons, and the first 3 are grouped into a group called "three buttons":
-
Screenshot 2023-11-19 at 19.07.01.png
-
Now, here I have ungrouped those 3 buttons and grouped the other 3 buttons, and, as you can see the group is the same group as I used previously:
-
Screenshot 2023-11-19 at 19.07.32.png
-
If you LOCK your group, if you do the same thing as above the group will retain the bounding rectangle it had, and the second set of buttons will not be visible.

THEREFORE, if you ungroup a group and want to avoid that situation, it is quite a good idea to place a random object on your card, group it and then, via the messageBox DELETE the group.
CAsba
Posts: 452
Joined: Fri Sep 30, 2022 12:11 pm

Re: Still a beginner who doesn't know how to make a group.

Post by CAsba »

Hi guys,
Thanks for all that. I managed to make a group ! Of course, it's simple when you know how, but for me, the click by click instructions were essential. One other thing..I named the group 'Group1' by editing the group NUMBER that showed up in the PB - and it functions.
Is that the usual way to name the group - I didn't see any other options for naming.
Once again, many thanks.
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10430
Joined: Fri Feb 19, 2010 10:17 am

Re: Still a beginner who doesn't know how to make a group.

Post by richmond62 »

I always name my groups like this:
-
Screenshot 2023-11-19 at 20.55.23.jpg
-
Screenshot 2023-11-19 at 20.56.06.jpg
Screenshot 2023-11-19 at 20.56.06.jpg (32.36 KiB) Viewed 39795 times
-
Obviously the group has to be SELECTED and that only happens right after you have grouped the objects.

What I like about this is that you can set other parameters of the group:
-
Screenshot 2023-11-19 at 20.59.53.jpg
Screenshot 2023-11-19 at 20.59.53.jpg (33.17 KiB) Viewed 39794 times
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Still a beginner who doesn't know how to make a group.

Post by Klaus »

Hi CAsba
CAsba wrote: Sun Nov 19, 2023 7:51 pm...
One other thing..I named the group 'Group1' by editing the group NUMBER that showed up in the PB - and it functions.
Is that the usual way to name the group - I didn't see any other options for naming...
well, you can name your group "Susan" if that makes you happy! :-D
Jokes aside, whatever name fits for your project and is meaningful enough will do!

Best

Klaus
stam
Posts: 3214
Joined: Sun Jun 04, 2006 9:39 pm

Re: Still a beginner who doesn't know how to make a group.

Post by stam »

Klaus wrote: Sun Nov 19, 2023 8:03 pm well, you can name your group "Susan" if that makes you happy! :-D
Jokes aside, whatever name fits for your project and is meaningful enough will do!
"Group me up and call me Susan" sounds ...suggestive ;)
CAsba
Posts: 452
Joined: Fri Sep 30, 2022 12:11 pm

Re: Still a beginner who doesn't know how to make a group.

Post by CAsba »

Hi Klaus,
Susan, yeah, how come you know about Susan ? This is a most private part of my life ! Was it you who....?
(Still joking)
My query was open to misinterpretation.. I meant to ask 'is this the usual method to name a group ?' (doing it in project browser).
Also, I just tried to put fld "xxx" into fld "selection2" of group "group1" of cd "yyy" and it didn't work. Maybe the group is inappropriate here ?
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Still a beginner who doesn't know how to make a group.

Post by Klaus »

Hi CAsba,

I tried exactly this:

Code: Select all

...
put fld "xxx" into fld "selection2" of group "group1" of cd "yyy"
...
and it worked as exspected!? Did you get an error or something?
I meant to ask 'is this the usual method to name a group ?' (doing it in project browser).
Yes, via script or the inspector, there are no other ways.

Best

Klaus

P.S.
Clairvoyance is one of my hobbies! :-D
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10430
Joined: Fri Feb 19, 2010 10:17 am

Re: Still a beginner who doesn't know how to make a group.

Post by richmond62 »

(doing it in project browser)
Wow! Must give it a try sometime: I suppose it'll make a difference from doing it in the bed.

As I have already indicated, you can "do it" via the Properties palette.

As to:
the usual method to name a group
There are at least 4 ways I know of naming a group:

1. via the Properties palette.

2. scripting via the messageBox.

3. via the Application browser.

4. via the Project browser.

as to 'usual' and 'normal': well, luckily, we don't have to worry about that as xTalk is marvellous in that almost always one can achieve something in many different ways. 8)
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Still a beginner who doesn't know how to make a group.

Post by Klaus »

Ah, yes, forogt the "Project Browser"!
A docubleclick on the name of an object in the PB also lets you give it another name.
Post Reply