How to protect objects within a group?

Graham Samuel livfoss at mac.com
Thu Jun 20 07:04:32 EDT 2013


I have a kind of drawing space on a card where a user can create graphics. I also have a group showing on this card, which is in fact a group of mixed controls, including both graphics and fields,. I have a button that deletes all the graphics on the card by simply doing a loop from 1 to the number of grcs on the card and deleting each grc as it passes through. My group (which I don't want to delete) clearly is not itself a graphic: nevertheless my button deletes all the graphics in the group, from which it appears that each graphic can be accessed separately even when it' s grouped.

I thought that by setting the selectGroupedControls to false, I would protect the graphics inside the group from being selected. Not apparently if the selection is done by script. I also tried setting the cantDelete of the group to true, and that didn't seem to work either: elements of the group can still be deleted.

Luckily in this specific case there is only the one group on the card, so I can tell my loop not to delete those graphics that have the word "group" in their long ID, and this works.

This seems incredibly clunky: is there another way to distinguish between graphics (or in principle, other objects) within a group and graphics outside?

TIA

Graham



More information about the use-livecode mailing list