Suicide

panagiotis merakos merakosp at gmail.com
Sat Aug 27 08:16:22 EDT 2016


What is the use case, Richmond? If you want to delete any object on a card
by just clicking on it, you can put this on the card script:

on mouseup
   delete the mousecontrol
end mouseup

and make sure that the objects you want to delete do not have a mouseup
handler.

On Sat, Aug 27, 2016 at 2:55 PM, Paul Dupuis <paul at researchware.com> wrote:

> On 8/27/2016 7:27 AM, Richmond wrote:
> > on mouseUp
> >    delete me
> > end mouseUp
>
> The engine can not delete an object whose script is currently executing.
> This has been a long know issue in LiveCode, but I am not sure it has
> been documented
>
> In the Dictionary for "Delete" there is a warning: "Important!  You
> cannot delete the object whose script holds a currently executing
> handler." but no explaination of the typical work-around below.
>
> on mouseUp
>   put the long id of me into tTarget
>   send "delete tTarget" to me in 0 ticks
> end mouseUp
>
> So I guess you have to use "Assisted Suicide" since you need to send a
> message to the engine to delete the object after it's script is done.
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list