Event won't propagate on Window Topic is solved
Event won't propagate on Window
I am using wxWigets 3.1.1 on Windows 10, with Visual Studio Community 2017. On the window in the bottom-left corner of the screen, when you press down on the left mouse key, it's supposed to trigger an event that calls MyFrame::OnLeftDown(). But the function never gets called.
- Attachments
-
- sfcTileMapEditor.zip
- (14.63 KiB) Downloaded 65 times
Re: Event won't propagate on Window
Mouse events don't propagate upwards in the window hierarchy. Only wxCommandEvents do.
You have to catch them in the control where they occur.
You have to catch them in the control where they occur.
Use the source, Luke!
Re: Event won't propagate on Window
EditWindowEvent inherits from wxCommandEvent. In addition, I just tried Bind() instead of the event table, and the event handler function MyFrame::OnLeftDown() still isn't called!
Is there something wrong in the way I've set up the events?
Is there something wrong in the way I've set up the events?
Re: Event won't propagate on Window
For a test, try wxID_ANY for the ID in the event table. If it works then, you know that the ID is wrong.
Use the source, Luke!
Re: Event won't propagate on Window
Even using wxID_ANY in the event table, it does not work. I tried Bind() with it, too, and it still did not work.
I guess something's wrong with the way the events are declared or defined? The event-type is declared in EditWindow.h, and defined in EditWindowEvent.cpp.
I guess something's wrong with the way the events are declared or defined? The event-type is declared in EditWindow.h, and defined in EditWindowEvent.cpp.
Re: Event won't propagate on Window
Code: Select all
void EditWindow::OnMouseDown(wxMouseEvent& event) {
EditWindowEvent ev(GetId(), myEVT_TILELEFTDOWN);
Use the source, Luke!