Page 1 of 1
Groups and sub-groups
Posted: Mon Oct 19, 2020 8:47 pm
by odysseus
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.
Re: Groups and sub-groups
Posted: Mon Oct 19, 2020 8:50 pm
by FourthWorld
The IDE's Project Browser lets you access object scripts easily.
Re: Groups and sub-groups
Posted: Mon Oct 19, 2020 9:42 pm
by dunbarx
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
Re: Groups and sub-groups
Posted: Mon Oct 19, 2020 11:59 pm
by odysseus
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).
Re: Groups and sub-groups
Posted: Tue Oct 20, 2020 2:03 am
by dunbarx
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
Re: Groups and sub-groups
Posted: Tue Oct 20, 2020 2:45 am
by FourthWorld
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?
Re: Groups and sub-groups
Posted: Tue Oct 20, 2020 11:52 am
by odysseus
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.
Re: Groups and sub-groups
Posted: Tue Oct 20, 2020 4:42 pm
by FourthWorld
One could script that in LC, but probably best with a modifier key, so a straight doubleclick still brings up the Inspector.
Re: Groups and sub-groups
Posted: Tue Oct 20, 2020 4:44 pm
by FourthWorld
On TB, what gets selected if you doubleclick a group that contains multiple groups?
Re: Groups and sub-groups
Posted: Tue Oct 20, 2020 5:25 pm
by jacque
"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.
Re: Groups and sub-groups
Posted: Tue Oct 20, 2020 8:37 pm
by odysseus
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
Re: Groups and sub-groups
Posted: Tue Oct 20, 2020 10:49 pm
by odysseus
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’.
Re: Groups and sub-groups
Posted: Wed Oct 21, 2020 1:18 am
by FourthWorld
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?
Re: Groups and sub-groups
Posted: Wed Oct 21, 2020 12:53 pm
by odysseus
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.
Re: Groups and sub-groups
Posted: Wed Oct 21, 2020 4:23 pm
by FourthWorld
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.