on deleteGroup

David Bovill david.bovill at gmail.com
Thu Jan 7 10:21:09 EST 2010


Hi Devin - the problem is no message is sent so I can't tell when the group
is deleted. The only way to do that is have a front script, but I was hoping
to use behaviors - so i could script a component without having to install
somethin in a users development environment.

2010/1/4 Devin Asay <devin_asay at byu.edu>

>
> On Jan 1, 2010, at 12:45 PM, David Bovill wrote:
>
>  Just noticed that the deleteGroup message is not sent when the group is
>> nested - anyone got an idea how to get around this?
>>
>> Say you have a group that you want to do some tidying up if a user deletes
>> it - and so you put a handler like this in the group itself:
>>
>> on deleteGroup
>>
>>>  beep
>>>  doSomeTidying
>>>  pass deleteGroup
>>> end deleteGroup
>>>
>>>
>> Which works fine if it is a toplevel group - but when this group is inside
>> another group deleting the toplevel group triggers a deleteGroup message
>> which travels up the hierarchy to the card - but no deleteGroup messages
>> are
>> sent from the inner groups - this means you can't attach appropriate
>> behaviors to the groups.
>>
>> Wandering if anyone has looked at this - I can't think how to do it as
>> deleteGroup is sent after deletion so even a frontscript would not be able
>> to tell what was inside a deleted group. Even the new closeControl message
>> does not seem to be sent in these circumstances?
>>
>
> David,
>
> Maybe you'll need to check the child objects of the group before you delete
> the parent group. If they have child groups delete them first from the
> "inside out", so that each group is deleted individually and so triggers the
> deleteGroup message.
>
> repeat with x= 1 to the number of groups in group "parent"
>  if there is a group x of group "parent" then
>    delete group x of group "parent"
>   else
>    exit repeat
>  end if
> end repeat
>
> Regards,
>
> Devin
>
>
> Devin Asay
> Humanities Technology and Research Support Center
> Brigham Young University
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the use-livecode mailing list