DrawableButton: holding down state until mouse button is up


I wanted to use DrawableButtons for executing move and zoom in my 2D/3D viewer components.

The user would push the mouse button inside the DrawableButton (the DrawableButton will now show the down image), then hold the mouse button down and drag to move/zoom the image.

Unfortunately the standard (and otherwise logical) behavior of the DrawableButton is to return to the normal image as soon as the mouse pointer leaves the component. For this use of the DrawableButton it would be better to keep the down image until the mouse up event, even if the mouse pointer left the component.

Is there a way to trick the DrawableButton into working as I want here or should I manage this without the DrawableButton, by manually handling the mouse events and the images?


I think you’d have to hack the button base class to get that to work…

If it was me, I’d probably just write a custom component to do it (which would be pretty simple to do)