Re: Changing mouse position from Pharo.
Posted by
Carla F. Griggio on
Mar 13, 2013; 11:59am
URL: https://forum.world.st/Changing-mouse-position-from-Pharo-tp4676580p4676584.html
Hey!
Uff, yes. When Germán and I did this project:
http://ss3.gemstone.com/ss/KinematicTemplates.html, we had to fight a lot with that.
Take a look at the code.
In the package KinematicTemplates-FFI there's a class Invokator that changes the cursor position at OS level:
Invokator(class)>>apiCGWarpMouseCursorPosition: aCGPoint
"CGError CGWarpMouseCursorPosition(CGPoint newCursorPosition);"
< apicall: void 'CGWarpMouseCursorPosition' ( CGPoint ) module: 'CoreGraphics.framework'>
^ self externalCallFailed.
And then, an example of usage:
Invokator apiCGWarpMouseCursorPosition: (CGPoint from: 30@30 ).Tricky detail: if after evaluating that example you print
World activeHand position, it will not be 30@30, so you also have to update the activeHand's position:
World activeHand position: 30@30.Tell me if you need something else, or if this isn't really what you needed :P
Cheers,
Carla.
On Wed, Mar 13, 2013 at 12:28 PM, Santiago Bragagnolo
<[hidden email]> wrote:
Hi all!
I'm doing a bizarre experiment where i need to change the position of the mouse to a fixed point (like make the mouse pointer to jump from where it is to a button). Does anyone have a clue about how to?
Thanks in advance!
Santiago