How to protect objects within a group?
Klaus major-k
klaus at major-k.de
Thu Jun 20 07:29:52 EDT 2013
Hi Graham,
Am 20.06.2013 um 13:04 schrieb Graham Samuel <livfoss at mac.com>:
> 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?
you can check "the owner of grc xyz" or "the short name of the owner of grc xyz" in the repeat loop.
This will be :
1. INSIDE -> the name of the group -> group "name of group"
2. OUSIDE -> the name of the the card -> card "name of card"
> TIA
>
> Graham
Best
Klaus
--
Klaus Major
http://www.major-k.de
klaus at major-k.de
More information about the use-livecode
mailing list