I'm using wxWidgets 3.0.3 on Windows 8.1, with my IDE being Visual Studio 2017 Community.
I inherited from wxScrolled<wxWindow> to create EditWindow, which has the event myEVT_TILEHOVER declared and defined, along with EditWindowEvent which inherits from wxEvent, EditWindowEventFunction which is a typedef, EditWindowEventHandler which is a #define that uses wxEVENT_HANDLER_CAST, and EVT_TILEEDIT a #define that is used on the relevant frame's event table.
So it's on a frame, MyFrame, which inherits from wxFrame. The class function MyFrame::OnTileHover() is the one that is supposed to handle the event. The actual sender of the event is a PaletteWindow, which inherits from EditWindow.
On debugging it, I find that the internal function in EditWindow which handles the EVT_MOTION DOES get called properly, but upon calling wxPostEvent(), the MyFrame::OnTileHover() handler never gets called.
What am I doing wrong here? The project is attached. The event is supposed to be activated when you move the mouse over the PaletteWindow in the lower left part of the screen.
Event fails to call event function Topic is solved
-
- Earned some good credits
- Posts: 111
- Joined: Fri Nov 27, 2009 2:49 am
Event fails to call event function
You do not have the required permissions to view the files attached to this post.
-
- Moderator
- Posts: 19164
- Joined: Fri Apr 21, 2006 8:03 pm
- Location: $FCE2
Re: Event fails to call event function
I only took a quick glance at the code, my first guess would be: Derive EditWindowEvent from wxCommandEvent instead of wxEvent, because only those propagate upwards in the window hierarchy.
Use the source, Luke!
-
- Earned some good credits
- Posts: 111
- Joined: Fri Nov 27, 2009 2:49 am
Re: Event fails to call event function
OK, got it, thanks!
BTW, if I use wxQueueEvent() instead of wxPostEvent(), it crashes. Why is this?
BTW, if I use wxQueueEvent() instead of wxPostEvent(), it crashes. Why is this?
-
- Moderator
- Posts: 19164
- Joined: Fri Apr 21, 2006 8:03 pm
- Location: $FCE2
Re: Event fails to call event function
Because wxQueueEvent expects a pointer to an event that was created on the heap and deletes it afterwards.BTW, if I use wxQueueEvent() instead of wxPostEvent(), it crashes. Why is this?
(As stated in the documentation...)
http://docs.wxwidgets.org/trunk/group__ ... d2c408bce1
Use the source, Luke!