Multiple dynamic event handlers for the same event - how?
Volker Bartheld
dr_versaeg at freenet.de
Wed Nov 21 11:53:40 PST 2007
Hi!
Might be that this question has been already asked before, so please accept
my apologies if it's a dumb one. Here we go:
I have a wxApp-derivate (MyApp) that spawns a single wxFrame (MyFrame).
There are several wxEvtHandlers (MyHandler1, MyHandler2, ...) that are all
interested in a single DECLARE_EVENT_TYPE(MY_EVENT, 1) because they do
different stuff with it.
Is it advisable to have all the wxEvtHandler::Connect() in a chain
(MyHandler1 calls MyApp::Connect(), MyHandler2 calls MyHandler2::Connect()
and so on), or better MyFrame or should they all subscribe to wxApp using
DECLARE_APP(MyApp), then ::wxGetApp().Connect() everywhere?
In what order are those handlers supposed to be called - especially in the
last option? First the window containing the control that created the event
(MyFrame) then all the handlers in order of registration (MyHandler1, then
MyHandler2, ...) and finally MyApp's handler?
I checked out "Event handling overview" in the wxDocu but am still not sure
which is the recommended way.
Thanks a lot for any advice,
Volker
--
mailto: V B A R T H E L D at G M X dot D E
More information about the wx-users
mailing list