Deleting an object !SOLVED!

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
nlexa
Posts: 26
Joined: Fri Aug 05, 2011 2:34 am

Deleting an object !SOLVED!

Post by nlexa » Mon Oct 29, 2012 4:56 am

From the livecode dictionary:
You cannot delete the object whose script holds a currently executing handler.
I have a group of controls. In that group of controls is a button with an x on it, like the little x in the top right hand corner of my browser window.
When I press the x I want the the button and the group it belongs to, to be deleted.

So I try to be clever and call commands on the card or on the stack that delete the group - but this doesn't work because "end mouseUp" in the script of the x button is the last thing to happen and therefore a "currently executing handler"

It would be easy just to set the visible to false but I actually want to delete it. Perhaps I just have to be creative about how my program works. But if anyone knows how to get something to delete itself please share
Last edited by nlexa on Thu Nov 08, 2012 4:54 am, edited 1 time in total.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Deleting an object

Post by FourthWorld » Mon Oct 29, 2012 5:45 am

A timer would allow this:

-- button:
on mouseUp
send "DeleteThang the short name of the parent of me" to this cd in 20 millisecs
end mouseUp

-- card:
on DeleteThang pGroup
delete grp pGroup
end DeleteThang
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

nlexa
Posts: 26
Joined: Fri Aug 05, 2011 2:34 am

Re: Deleting an object

Post by nlexa » Thu Nov 01, 2012 2:37 am

Thanks heaps! Why I didn't think of this before I don't know but that's the power of the forum :D

Post Reply