feature request: optionally deleting the whole chain of event
handlers, when window is deleted
Vadim Zeitlin
vadim at wxwidgets.org
Fri Feb 1 09:15:22 PST 2008
On Fri, 1 Feb 2008 03:12:07 -0800 (PST) chris <cb at delta-h.de> wrote:
c> this feature would need an additional flag when adding a handler to a
c> window:
c>
c> void wxWindowBase::PushEventHandler(wxEvtHandler *handler, const bool&
c> shouldBeDeletedWithWindow = false);
Unless I'm missing something, this would require adding a field to each
wxEvtHandler (and hence each wxWindow) indicating whether it should be
deleted with the window it is associated with. I don't think it's a good
trade-off.
The solution I use when I need to push-and-forget an event handler is to
catch window destruction event in this handler and do "delete this" from
it. I think it would be nice to have a base class implementing this in a
reusable manner so that you could get this functionality by just deriving
from this wxAutoDeletedEventHandler class.
Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
More information about the wx-users
mailing list