I had a GUI application with the following layout:
wxFrame --> wxBoxSizer --> wxImagePanel
The wxImagePanel is a custom control (available here). I’ve modified it slightly to handle mouse events (using EVT_MOTION) like dragging that allows me to pan the image.
Now, unfortunately, this looks ugly on Windows — there’s a dark gray background. The recommended approach is to add a wxPanel to the wxFrame — this makes the ugly background go away. The app is now layed out like this:
wxFrame --> wxBoxSizer --> wxPanel --> wxBoxSizer --> wxImagePanel (a custom control)
It looks a lot better, but now the wxPanel I’ve added is grabbing all the mouse motion events. They don’t get through to the child wxImagePanel, so I can’t pan my image anymore.
How can I make sure the mouse motion events make it through to the child wxImagePanel?
I’ve solved the problem by asking on the wxWidgets forums.
Basically, my problem was the wxImagePanel was a child of the wxFrame, whereas it should have been a child of the wxPanel instead.