Groups and sub-groups

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
odysseus
Posts: 40
Joined: Tue Aug 25, 2020 2:15 pm

Groups and sub-groups

Post by odysseus » Mon Oct 19, 2020 8:47 pm

So here’s another one for you experts out there. I have a group on the card with fields, buttons and several controls which are themselves groups. As I am developing my program, I need to add/amend scripts in the sub- groups.

However I cannot get to the sub-groups easily, because when I use the ‘Select Grouped’ menu option, everything is temporarily ungrouped, including my sub-groups, so I can’t modify them. The only (cumbersome) way I can do this is to copy the whole group to a blank card, ungroup it (which leaves the sub-groups intact), modify them, then select all and regroup, then copy the modified main group back to where it belongs.

If the sub-groups have sub-groups it gets even worse. Surely there must be an easier way to do this.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 8143
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Groups and sub-groups

Post by FourthWorld » Mon Oct 19, 2020 8:50 pm

The IDE's Project Browser lets you access object scripts easily.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7152
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Groups and sub-groups

Post by dunbarx » Mon Oct 19, 2020 9:42 pm

Or you can, by hand:

Code: Select all

edit the script of group "yourSubgroup"
This may be cumbersome to do infrequently. But if you intend to do it often during development, make a locked field with the names of all your groups, so that if you click on one, the script opens. You can add or subtract groups as you need. It is a mini-project running alongside you actual project, but I do this sort of thing all the time.

Craig

odysseus
Posts: 40
Joined: Tue Aug 25, 2020 2:15 pm

Re: Groups and sub-groups

Post by odysseus » Mon Oct 19, 2020 11:59 pm

Thanks for that, it helps for scripts, but if I want to change the appearance of the sub-group, or sub-sub-group, I need to get to it to work on. What I need is what I was used to in Toolbook, where you could ‘drill down’ into groups sequentially by double clicking - so simple but effective.

It sounds like I am harping on, though there are a lot of things Livecode does very well, and I am sure I have only scratched the surface, but I am surprised that there is a lot that the 30 year old Toolbook does much better. Unfortunately it is no longer supported, and Windows only (which is why I am converting).

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7152
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Groups and sub-groups

Post by dunbarx » Tue Oct 20, 2020 2:03 am

Hi.

You can do anything in LC. Try this in the script of that locked field, you know, the one with the names of all groups, one on each line:

Code: Select all

on mouseUp
   if the optionKey is down then edit the script of group the value of the clickLine
   if the commandKey is down then
      select group the value of the clickLine
      select menuItem 1 of menu "Object"
   end if
end mouseUp
Craig

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 8143
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Groups and sub-groups

Post by FourthWorld » Tue Oct 20, 2020 2:45 am

odysseus wrote:
Mon Oct 19, 2020 11:59 pm
Thanks for that, it helps for scripts, but if I want to change the appearance of the sub-group, or sub-sub-group, I need to get to it to work on. What I need is what I was used to in Toolbook, where you could ‘drill down’ into groups sequentially by double clicking - so simple but effective.
In LC we have an Edit Group feature - select the group in the Project Browser, then select the item from the menu.

It may not be hard to craft a drill-down like TB's as a plugin. Can you describe more now that works? Does it limit double-click to be used solely for nested group navigation?
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

odysseus
Posts: 40
Joined: Tue Aug 25, 2020 2:15 pm

Re: Groups and sub-groups

Post by odysseus » Tue Oct 20, 2020 11:52 am

So one click selects the group. Then a double click selects the item clicked on (e.g. a button in a graphic). If there is a nested group, double clicking on that selects that group, then another double click within that group selects the object clicked on in that group and so on. A single click outside the main group deselects everything. Double click is still available for other things.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 8143
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Groups and sub-groups

Post by FourthWorld » Tue Oct 20, 2020 4:42 pm

One could script that in LC, but probably best with a modifier key, so a straight doubleclick still brings up the Inspector.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 8143
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Groups and sub-groups

Post by FourthWorld » Tue Oct 20, 2020 4:44 pm

On TB, what gets selected if you doubleclick a group that contains multiple groups?
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5658
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Groups and sub-groups

Post by jacque » Tue Oct 20, 2020 5:25 pm

"Select Grouped" only determines what is selected when clicked. If it's on, grouping is ignored. If off, it selects the whole group instead. It doesn't affect the actual groups themselves.

To do what you want, make sure that Select Grouped is off. With the edit tool, click on any object inside the group to select the entire group. In the toolbar, click "Edit group". Now you will see the group itself with its subgroups. To drill down more, select a subgroup and again choose Edit Group. You can drill down as needed.

When you choose Stop Editing you will exit editing mode. It doesn't back out sequentially.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

odysseus
Posts: 40
Joined: Tue Aug 25, 2020 2:15 pm

Re: Groups and sub-groups

Post by odysseus » Tue Oct 20, 2020 8:37 pm

Thanks jaque, ok for scripts , but not so for visual editing as the rest of the group disappears, so we don’t know where we are

odysseus
Posts: 40
Joined: Tue Aug 25, 2020 2:15 pm

Re: Groups and sub-groups

Post by odysseus » Tue Oct 20, 2020 10:49 pm

Richard, it depends where you click. A single click just selects the main group. If you double click on a nested group, that group is selected. If you double click again on that nested group you select a component of that nested group and so on. So the selected object is the last object double clicked on - a component of the main group, a nested group or a component of it. No need to look things up, or ‘select grouped’ or ‘edit group’.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 8143
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Groups and sub-groups

Post by FourthWorld » Wed Oct 21, 2020 1:18 am

How long is the interval threshold between the two double clicks that register as a drill-down, as opposed to two double clicks that are two separate double clicks?
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

odysseus
Posts: 40
Joined: Tue Aug 25, 2020 2:15 pm

Re: Groups and sub-groups

Post by odysseus » Wed Oct 21, 2020 12:53 pm

It doesn't matter. If you double click and wait, the selected object just sits and waits to be acted on, if you keep double clicking quickly, you get down through the group and sub groups until you've broken into the final sub group. Further double clicks have no effect. A click outside the main group deselects everything.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 8143
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Groups and sub-groups

Post by FourthWorld » Wed Oct 21, 2020 4:23 pm

Thanks for that. It's been a long time since I shipped a system using Toolbook; so much forgotten over the years.

In LC you could write a plugin for that, but I suspect it would not be widely used, since we rely on doubleclick to bring up the Inspector.

That said, of you prefer it over the provided means of working with nested groups it would certainly be a good learning exercise.

To get you started, you'd want to trap the mouseDoubleUp message from a frontscript to override the IDE's handling of that message.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”