Move cursor with code?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Move cursor with code?

Marcus Pedersén
Hi!
How do I move the cursor with code to a specific point?
As I understand I get hold of the cursor by executing:
cursor := World activeHand , right?
After that I tried to put cursor in center of world with:
cursor position: (World center)
and tried:
cursor x: (World center x) y: (World center y)
Nothing happened?
What am I doing wrong?
Many thanks in advance!
Marcus

Reply | Threaded
Open this post in threaded view
|

Re: Move cursor with code?

Tom Phoenix
On 6/6/06, Marcus Pedersén <[hidden email]> wrote:

> How do I move the cursor with code to a specific point?

I don't believe that Squeak VMs (by default, at least) include any
support for affecting the mouse position of the underlying system.
That is to say, the mouse position is controlled by the OS, not
Squeak. But on some operating systems, you may be able to do what you
want with a custom primitive. Good luck with it!

--Tom Phoenix

Reply | Threaded
Open this post in threaded view
|

Re: Move cursor with code?

Bert Freudenberg-3

Am 06.06.2006 um 14:14 schrieb Tom Phoenix:

> On 6/6/06, Marcus Pedersén <[hidden email]> wrote:
>
>> How do I move the cursor with code to a specific point?
>
> I don't believe that Squeak VMs (by default, at least) include any
> support for affecting the mouse position of the underlying system.
> That is to say, the mouse position is controlled by the OS, not
> Squeak. But on some operating systems, you may be able to do what you
> want with a custom primitive. Good luck with it!

You'll need more than luck to programmatically move a user's finger  
on a touch screen, though ;-)

- Bert -


Reply | Threaded
Open this post in threaded view
|

Re: Move cursor with code?

Michael Rueger-6
In reply to this post by Tom Phoenix
Tom Phoenix wrote:
> On 6/6/06, Marcus Pedersén <[hidden email]> wrote:
>
>> How do I move the cursor with code to a specific point?
>
>
> I don't believe that Squeak VMs (by default, at least) include any
> support for affecting the mouse position of the underlying system.

Well, one of my favorite "what the hell was the person thinking" gripes...

primCursorLocPut: aPoint
        "If the primitive fails, try again with a rounded point."

        <primitive: 91>
        ^ self primCursorLocPutAgain: aPoint rounded


Only that the primitive got abused for something else:

supportsDisplayDepth: pixelDepth
        "Return true if this pixel depth is supported on the current host platform.
        Primitive. Optional."
        <primitive: 91>
        ^#(1 2 4 8 16 32) includes: pixelDepth

causing the need for custom ffi calls on platforms now. Somebody at
impara actually went through the effort, we should have that code
somewhere, I think...

Michael

Reply | Threaded
Open this post in threaded view
|

Re: Move cursor with code?

Michael Rueger-6
Michael Rueger wrote:

> causing the need for custom ffi calls on platforms now. Somebody at
> impara actually went through the effort, we should have that code
> somewhere, I think...

OK, attached some support for Windows (winCursor).
There is also some Mac and X11 code attached, am not an expert on those
platforms...
Once the support code works we could hook it into InputSensor to replace
the non-functional primitive call.

Michael



winCursor.cs.gz (1K) Download Attachment
TSys-OSX.st.gz (674 bytes) Download Attachment
TSystem.st.gz (2K) Download Attachment