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: FourthWorld, heatherlaine, Klaus, kevinmiller

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

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

Post by CAsba » Fri Nov 17, 2023 5:21 pm

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: 9678
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

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

Post by dunbarx » Fri Nov 17, 2023 5:33 pm

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: 13836
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

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

Post by Klaus » Fri Nov 17, 2023 5:37 pm

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: 9678
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

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

Post by dunbarx » Fri Nov 17, 2023 5:38 pm

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: 9678
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

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

Post by dunbarx » Fri Nov 17, 2023 5:39 pm

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: 9678
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

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

Post by dunbarx » Fri Nov 17, 2023 5:45 pm

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: 9417
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

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

Post by richmond62 » Sun Nov 19, 2023 6:12 pm

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: 368
Joined: Fri Sep 30, 2022 12:11 pm

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

Post by CAsba » Sun Nov 19, 2023 7:51 pm

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: 9417
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

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

Post by richmond62 » Sun Nov 19, 2023 7:58 pm

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 33537 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 33536 times

Klaus
Posts: 13836
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

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

Post by Klaus » Sun Nov 19, 2023 8:03 pm

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: 2692
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

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

Post by stam » Sun Nov 19, 2023 8:06 pm

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: 368
Joined: Fri Sep 30, 2022 12:11 pm

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

Post by CAsba » Mon Nov 20, 2023 11:12 am

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: 13836
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

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

Post by Klaus » Mon Nov 20, 2023 11:20 am

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: 9417
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

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

Post by richmond62 » Mon Nov 20, 2023 12:48 pm

(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: 13836
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

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

Post by Klaus » Mon Nov 20, 2023 1:08 pm

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

Return to “Getting Started with LiveCode - Complete Beginners”