Page 1 of 1

Delete a Group in a Card's "on closeCard" handler

Posted: Fri Jun 27, 2008 11:33 pm
by mokogobo
I'm attempting to delete a dynamically created group created in a card when it is closed (cleanup). I get an error message saying that the group is locked or it's script is executing. The group isn't locked. I'm not sure how to determine if the script is still executing (the group contains a few Image objects with scripts).

Is there a way to do this?

Re: Delete a Group in a Card's "on closeCard" hand

Posted: Fri Jun 27, 2008 11:40 pm
by mokogobo
mokogobo wrote:I'm attempting to delete a dynamically created group created in a card when it is closed (cleanup). I get an error message saying that the group is locked or it's script is executing. The group isn't locked. I'm not sure how to determine if the script is still executing (the group contains a few Image objects with scripts).

Is there a way to do this?
Actually, it is disabled. I'm actually deleting the groups before the "on closeCard" message, too. This is strange.

Posted: Fri Jun 27, 2008 11:51 pm
by mokogobo
I replaced the "delete" command with the "remove" command, and it works... why would this be? The group only ever exists on the one card.

Replaced:

Code: Select all

# Clean up generated session inkey objects
repeat while exists(group "session_inkey_group")
  delete group "session_inkey_group"
end repeat
With:

Code: Select all

# Clean up generated session inkey objects
repeat while exists(group "session_inkey_group")
  remove group "session_inkey_group" from this card
end repeat

Posted: Fri Jun 27, 2008 11:55 pm
by mokogobo
Answered my own question:

From the Documentation for "delete":
Use the delete command to remove objects or text from the stack.
From the Documentation for "remove":
Use the remove command to remove a group from a card without removing it from the stack.
The group was never shared across the stack, so I suspect that there were issues with the mechanics of the delete command. I'm not sure why this works from a button's "on mouseUp" hanlder (for example), but not from the card's "on closeCard" handler.[/quote]