feature request: optionally deleting the whole chain of event handlers, when window is deleted

chris cb at delta-h.de
Mon Feb 4 02:09:20 PST 2008


On 4 Feb., 10:24, va... at wxwidgets.org (Vadim Zeitlin) wrote:
> On Mon, 4 Feb 2008 01:11:43 -0800 (PST) chris <c... at delta-h.de> wrote:
>
> c> > c> That's because I dont want to call 'delete this' anywhere.
> c> >
> c> >  Is there any reason for this?
> c>
> c> Yes. Try googling for 'delete this'. It's not known as a good design
> c> choice.
>
>  Sorry, but this is not a convincing argument: Try googling for anything.
> You will find someone arguing for it.

At first I have to apologize: That sound really arrogant, saying 'try
googling ...'. I was a little fast shouting with this answer.
Didn't mean it that way.
When I started with my extra event handlers, some month ago, i first
thought of calling 'delete this' the way you described. Wondering if
this is legal I started googling and found many answers.
Yes thats totally legal, but used the wrong way will lead to serious
problems. Following a discussion at comp.lang.c++.moderated with about
50 entries was too much to read for me so i decided to write this
manager object to be on the sure side.
Agreed, all of this is philosophical and offtopic here.

>
>  Whatever philosophical objections you may have to this technique, it is
> perfectly legal and is the best design possible in some (well known) cases.
> This is one of them and wx already uses it in a few other cases.
>
> c> > I don't see any problem with catching wxEVT_CLOSE_WINDOW
>
>  BTW, it's wxEVT_DESTROY, not wxEVT_CLOSE_WINDOW, which should be used. It

Programming wx for about 5 years and never read about wxEVT_DESTROY.
If I have heard about this before, all the discussion and many hours
of brain work weren't necessary.
Call me stupid, but where do I find anything about this event in the
manual?

Regards
chris






More information about the wx-users mailing list