# MouseMove(x,y)

**URL:** <https://forum.xojo.com/t/mousemove-x-y/45644>\
**Category:** General\
**Created:** [October 4, 2018, 5:57pm UTC](https://forum.xojo.com/t/mousemove-x-y/45644 "2018-10-04T17:57:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Djamel\_AIT\_AMRANE](https://forum.xojo.com/user_avatar/forum.xojo.com/djamel_ait_amrane/32/20260_2.png) [@Djamel\_AIT\_AMRANE](https://forum.xojo.com/u/Djamel_AIT_AMRANE)\
**Post date:** [October 4, 2018, 5:57pm UTC](https://forum.xojo.com/t/mousemove-x-y/45644/1 "2018-10-04T17:57:21Z")

</div>

Hello,  
How to get MouseMove coordinates x,y out of MouseMove event (canvas) ?  
I want to get x,y coordinates from a method or anywhere in the project.

---

<div class="post-metadata">

**Author:** ![brian\_franco](https://forum.xojo.com/user_avatar/forum.xojo.com/brian_franco/32/156_2.png) [@brian\_franco](https://forum.xojo.com/u/brian_franco)\
**Post date:** [October 4, 2018, 6:14pm UTC](https://forum.xojo.com/t/mousemove-x-y/45644/2 "2018-10-04T18:14:36Z")

</div>

Add 2 int properties (moveX and moveY)

Then in mousemove set those properties to the value of X and Y

Then you can call those values how you see fit or when you need them

You can display them in a TextField just to see that it works

---

<div class="post-metadata">

**Author:** ![Djamel\_AIT\_AMRANE](https://forum.xojo.com/user_avatar/forum.xojo.com/djamel_ait_amrane/32/20260_2.png) [@Djamel\_AIT\_AMRANE](https://forum.xojo.com/u/Djamel_AIT_AMRANE)\
**Post date:** [October 5, 2018, 10:00am UTC](https://forum.xojo.com/t/mousemove-x-y/45644/3 "2018-10-05T10:00:07Z")

</div>

I do it, mouseX property named mX and mouseY named mY  
in MouseEvent, mX=X, mY=Y .  
TextField1.text = str(mx) … , doesn’t work.

---

<div class="post-metadata">

**Author:** ![Greg\_O\_Lone](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o_lone/32/49_2.png) [@Greg\_O\_Lone](https://forum.xojo.com/u/Greg_O_Lone)\
**Post date:** [October 5, 2018, 10:50am UTC](https://forum.xojo.com/t/mousemove-x-y/45644/4 "2018-10-05T10:50:49Z")

</div>

Global methods are available on the System Module.

```auto
System.MouseX
```

If you want them relative to the window, subtract its top left corner

```auto
System.MouseX - TrueWindow.Left
```

---

<div class="post-metadata">

**Author:** ![brian\_franco](https://forum.xojo.com/user_avatar/forum.xojo.com/brian_franco/32/156_2.png) [@brian\_franco](https://forum.xojo.com/u/brian_franco)\
**Post date:** [October 5, 2018, 1:59pm UTC](https://forum.xojo.com/t/mousemove-x-y/45644/5 "2018-10-05T13:59:45Z")

</div>

Here is an example but as Greg mentioned there is also System Module

[GetMouseEvent](http://www.brimansoftware.com/GetMouseEvent.zip)

---

<div class="post-metadata">

**Author:** ![Djamel\_AIT\_AMRANE](https://forum.xojo.com/user_avatar/forum.xojo.com/djamel_ait_amrane/32/20260_2.png) [@Djamel\_AIT\_AMRANE](https://forum.xojo.com/u/Djamel_AIT_AMRANE)\
**Post date:** [October 5, 2018, 4:32pm UTC](https://forum.xojo.com/t/mousemove-x-y/45644/6 "2018-10-05T16:32:26Z")

</div>

It’s perfect, thank’s brian, thank’s greg .

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 7:24pm UTC](https://forum.xojo.com/t/mousemove-x-y/45644/7 "2020-10-29T19:24:16Z")

</div>


