Dear Members,
If have a component on a panel.
If I move that component to another panel, It has to be deleted. (something like a trashbin)
I could do this with freeandnil(aComponent) and normally that works great.
But because I call it in a procedure of the component that has to be removed, I get a runtime error.
Anyone a hint, sample code somewhere?
Regards Chris
1) you never delete a control while it is dragged only after it has been released (ee mouse button up).
2) you can delegate the deletion to a later time using the queueasynccall mechanism to add a method to be executed when the application goes idle.
3) if you still want to delete on the spot then you have to
a) end the moving operation manually ee trigger the mouseup manually, make sure it will not receive any more messages
during destruction. The easiest way is to set its parent to nil, in some cases it might be required to set its owner to nil as well(highly unlikely but keep in mind).
b) make sure that the component become nil (ee use of freeandnil is mandatory)
c) change your code to test for nil before accessing it. I'm referring to the event handlers you have written and the sender parameter.
Well thats all from the top of my head. In all the above fail create a small demo to showcase the problem and I'll try to solve the problem for you.