Contents Up Previous Next

OnEvent

This is now a non-virtual function, with the same wxMouseEvent& argument as before. However you may wish to rename it OnMouseEvent. Add an EVT_MOUSE_EVENTS macro to the event table for your window, and the implementation of your function will need very few changes. However, if you wish to intercept different events using different functions, you can specify specific events in your event table, such as EVT_LEFT_DOWN.

Your OnEvent function is likely to have references to GetDC(), so make sure you create a wxClientDC instead. See Device contexts.

If you are using a wxScrolledWindow (formerly wxCanvas), you should call PrepareDC(dc) to set the correct translation for the current scroll position.