From Xojo Documentation

Read-Only Property (As Integer )
IntegerValue = aControl.MouseX

Supported for all project types and targets.

The X coordinate of the mouse (points). Measured from the top-left corner of the window.

Sample Code

This code is in the MouseDown event of a TextField and displays the X-coordinate at the point of the MouseDown event.

Me.Text = Str(Me.MouseX)