There’s nothing in juce to do that - you’d need to use OS calls to somehow send fake mouse events to the system queue. Not easy!
Or you could do it by calling the ComponentPeer mouse handling methods, I guess. You’d need to work out which ComponentPeer is under the mouse and call handleMouseDown, etc directly.
for the test, I wrote some code like bellowing.
but, it didn’t work… can you figure out the reason ?
/* this function call is working /
Desktop::setMousePosition(sx,sy);
/ this function call is not working /
peer->handleMouseDown(sx,sy,500);
/ this function call is not working */
peer->handleMouseUp(0,sx,sy,500);
Maybe because the componentpeers expect relative co-ords? And you’d need to send your own mouse-move events, too - the setMousePosition updates the mouse pos without actually sending any move messages.
I have modified the codes.
peer->globalPositionToRelative(sx,sy);
peer->handleMouseMove (sx, sy, 500);
peer->handleMouseDown(sx,sy,500);
peer->handleMouseUp(0,sx,sy,500);
It still doesn’t work.
all function calls in upper codes are not working at all.
is there any threshold time to handle mouse event inside juce core ?