deleting an object as a consequence of its handler

Phil Davis revdev at pdslabs.net
Thu Sep 26 19:07:42 EDT 2013


On 9/26/13 9:36 AM, Dr. Hawkins wrote:
> I have a section where, as a consequence of a closefield, it makes sense to
> just wipe the screen and generate it again.
>
> While the closeField handler is in the stack (actually, a button for
> behavior), this results in an error as the field, part of one of the groups
> getting deleted, is associated with the running script.
>
> What is the best way to deal with this?
>
> I could send in 0ms I suppose, but might another message in the queue jump
> ahead if that happens?

Try this when ready to delete:
     get flushEvents("all") -- optional?? to remove all pending events
     send "delete btn 1" to this card in -1 second -- or any negative 
number of secs, msecs, etc

The negative time will prioritize the sent message, putting it at the 
head of the line. (Thanks to Dar Scott for this)

Phil Davis
>
> Pass the closefield somehow (but it's already a stack script, and the main
> stack would have to do some checking to figure out where the closefield was
> coming from?).
>
> "set the expendable of the target to true" ?   :)
>

-- 
Phil Davis





More information about the use-livecode mailing list