Slider drag - pause mouse movement


#1

Hi guys, I’m trying to make a slider for which the mouse disappears on drag. The problem I’m having however is that the mouse is still moving while it is invisible, while I want it to reappear in the same location. What would be the best way to pause mouse movement while its invisible?

void ParameterSliderComponent::mouseDown(const MouseEvent &e)
{
Slider::mouseDown(e);
setMouseCursor(MouseCursor::NoCursor);
updateMouseCursor();
//Pause mouse movement?
}

void ParameterSliderComponent::mouseUp(const MouseEvent &e)
{
Slider::mouseUp(e);
setMouseCursor(MouseCursor::NormalCursor);
updateMouseCursor();
//Unpause mouse movement?
}


#2

I have tried to store/restore the mouse position on mouse down/up, but I cant seem to find a non const reference to the MouseInputSource.


#3

You can place the mouse position via the Desktop component static void Desktop::setMousePosition (Point< int > newPosition)

Desktop::setMousePosition (globalStartPosition);

The MouseInputSource is obviously a source of an event:

Represents a linear source of mouse events from a mouse device or individual finger in a multi-touch environment.

The result is visible on the screen i.e. Desktop.

(Funny thought to let the actual mouse run over the desktop via software :wink: )


#4

Thank you that’s what I was looking for.