Search code examples
c++wxwidgets

How to track mouse dragging?


What event do I need to write in my wxWidgets program so that I can track mouse dragging. I mean hold down the left mouse button and track the movement while it is pressed.


Solution

  • Bind(wxEVT_MOTION, [&](wxMouseEvent& event) {
        if (event.Dragging()) {
            if (event.LeftIsDown()) {
                // code
            }
        }
    });