Page 1 of 1

Deleting button while executing it's script

Posted: Sun Sep 30, 2012 3:34 pm
by adventuresofgreg
Hello: what is the best way to handle this? I need to delete a button from it's own script, but you can't delete an object whose script holds a currently executing handler.

Re: Deleting button while executing it's script

Posted: Sun Sep 30, 2012 4:33 pm
by Klaus
Hi Greg,

handle the deletion in the card script, something like this:

Code: Select all

command delete_button tName
  if there is a btn tName then
     delete btn tName
  end if
end delete_button
In the button:

Code: Select all

on mouseup
   ## your stuff here
   put the short name of me into tName
   send "delete_button tName" to this cd in 1
end mouseup
Tested and works :D

Best

Klaus

Re: Deleting button while executing it's script

Posted: Sun Sep 30, 2012 5:36 pm
by adventuresofgreg
Thanks Klaus. that will work