[Gambas-user] Cursor.X, Cursor.Y example
T Lee Davidson
t.lee.davidson at gmail.com
Tue Aug 1 18:47:10 CEST 2023
On 8/1/23 08:43, Demosthenes Koptsis wrote:
> But i get error "Cursor.X is not Static"
> How must i write the example code
> i want to show inside Labels the position of cursor X,Y
By your last sentence, do you mean you want to show the X and Y coordinates of the *mouse* cursor?
Mouse.X and Mouse.Y will give you the coordinates of the mouse cursor relative to the top, left corner of the Form when used in
the Form_MouseMove event handler. Mouse.ScreenX and Mouse.ScreenY, available at any time and not just within a MouseMove event,
will give you the coordinates of the mouse cursor relative to the top, left corner of the entire screen.
The X and Y properties of the Cursor class are dynamic and not static. To use them, you would need to create a new Cursor object
from the Cursor class (https://gambaswiki.org/wiki/comp/gb.qt4/cursor/_new). But, I think this is not what you want because
those properties represent only the X and Y coordinates of the hot spot of your custom cursor. They do not give the position of
the mouse cursor.
More information about the User