PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Error
  • Various
  • Limits in browser code
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Used in a process linked to the mouse or stylus (click code, rollover code, code of left or right button down), returns the horizontal position (X) of the mouse cursor in relation to the specified window or control.
You can find out:
  • the position of the mouse (or stylus) when a left click is performed in an image (function used in the click code of image).
  • the position of the mouse (or stylus) when hovering a window (function used in the optional "Mouse rollover" process of window).
WEBDEV - Browser code Used in a browser process (of a control or page), returns the horizontal position (X) of mouse cursor according to the specified marker.
Notes:
  • WINDEV The mouse position can also be returned by CursorPos. CursorPos should only be used to modify the mouse position.
  • AndroidUniversal Windows 10 AppJava This function should only be used in the processes of controls hovered by the mouse.
  • AndroidUniversal Windows 10 App MouseXPos returns the last known position of finger on the device screen.
Versions 16 and later
Android This function is now available for the Android applications.
Universal Windows 10 App This function is now available for the Windows Phone applications.
New in version 16
Android This function is now available for the Android applications.
Universal Windows 10 App This function is now available for the Windows Phone applications.
Android This function is now available for the Android applications.
Universal Windows 10 App This function is now available for the Windows Phone applications.
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Example
WINDEVReports and QueriesWindows MobileJavaUser code (UMC)
// "WIN_Drawing" window hovered by the mouse
// Optional code of the window
Message("Position of the mouse: X: " + MouseXPos() + "Y: " + MouseYPos())
WINDEVReports and QueriesAndroidiPhone/iPadWindows MobileUniversal Windows 10 AppJavaUser code (UMC)
// Displays a different message according to the location clicked
IF MouseXPos() > 25 THEN
Info("To the right")
ELSE
Info("To the left")
END
WEBDEV - Browser code
// "Drawing" page hovered by the mouse
// Optional code of the page
// Mouse moved (onmousemove)
Message("Position of the mouse: X: " + MouseXPos(mpPage) + "Y: " + MouseYPos(mpPage))
Syntax
WINDEVReports and QueriesAndroidiPhone/iPadWindows MobileUniversal Windows 10 AppJavaUser code (UMC)

Retrieving the mouse position in a window Hide the details

<Result> = MouseXPos([<Marker>])
<Result>: Integer
  • Horizontal position (or X coordinate) of the mouse (or stylus) in pixels. By default, this position is given in relation to the top left corner of control on which the left mouse button was pressed.
  • -1 if an error occurred.
<Marker>: Optional Integer constant
Versions 17 and later
WINDEVReports and QueriesAndroidiPhone/iPadWindows MobileJavaUser code (UMC) Marker used to calculate the position:
mpControl
(Default value)
Mouse position in relation to the top left corner of window (or window if the event occurs on the window).
If this constant is selected, MouseXPos must be used in the click code of the control.
mpScreenMouse position in the screen (in relation to the top left corner of screen).
mpWindowMouse position in relation to the top left corner of window.
mpImageMouse position in the image (in relation to the top left corner of image).
If this constant is selected, MouseXPos must be used in the click code of the Image control.
New in version 17
WINDEVReports and QueriesAndroidiPhone/iPadWindows MobileJavaUser code (UMC) Marker used to calculate the position:
mpControl
(Default value)
Mouse position in relation to the top left corner of window (or window if the event occurs on the window).
If this constant is selected, MouseXPos must be used in the click code of the control.
mpScreenMouse position in the screen (in relation to the top left corner of screen).
mpWindowMouse position in relation to the top left corner of window.
mpImageMouse position in the image (in relation to the top left corner of image).
If this constant is selected, MouseXPos must be used in the click code of the Image control.
WINDEVReports and QueriesAndroidiPhone/iPadWindows MobileJavaUser code (UMC) Marker used to calculate the position:
mpControl
(Default value)
Mouse position in relation to the top left corner of window (or window if the event occurs on the window).
If this constant is selected, MouseXPos must be used in the click code of the control.
mpScreenMouse position in the screen (in relation to the top left corner of screen).
mpWindowMouse position in relation to the top left corner of window.
mpImageMouse position in the image (in relation to the top left corner of image).
If this constant is selected, MouseXPos must be used in the click code of the Image control.
WEBDEV - Browser code

Retrieving the mouse position in a page Hide the details

<Result> = MouseXPos([<Marker>])
<Result>: Integer or real
  • Horizontal position (or X coordinate) of the mouse cursor in relation to the specified marker (in pixels),
  • 0 if the information is not available (depending on the browser used and on the control).
<Marker>: Optional integer constant
Marker used to calculate the position:
mpControl
(Default value)
Mouse position in relation to the top left corner of control (or page if the event occurs on the page).
If this constant is selected, MouseXPos must be used in the "OnClick" code of the control.
mpScreenMouse position in the screen (in relation to the top left corner of screen).
mpPageMouse position in relation to the top left corner of page (while taking the page "scrolling" into account).
Remarks
WINDEVReports and QueriesAndroidiPhone/iPadWindows MobileUniversal Windows 10 AppJavaUser code (UMC)

Error

The main error codes are as follows:
  • No window is opened.
  • No mouse click is performed.
  • MouseXPos is called in a code other than the click code of a control.
  • Click code run by Execute or ExecuteProcess.
WINDEVReports and QueriesAndroidiPhone/iPadWindows MobileUniversal Windows 10 AppJavaUser code (UMC)

Various

  • The vertical position of the mouse (or stylus) is returned by MouseYPos.
  • MouseXPos used in the selection code of row or table always returns 0.
  • AndroidUniversal Windows 10 AppJava This function should only be used in the processes of controls hovered by the mouse.
WEBDEV - Browser code

Limits in browser code

MouseXPos is not available:
  • in the browser procedures.
  • in the events directly or indirectly called from a browser procedure (via ExecuteProcess for example).
  • in the browser code of a button or link.
Related Examples:
The drawing functions Unit examples (WINDEV): The drawing functions
[ + ] Using the main drawing functions of WINDEV to:
- Initialize an Image control for drawing
- Draw simple shapes
- Write a text into a drawing
- Change the color in a drawing
Components
WINDEVReports and Queries wd230obj.dll
Windows Mobile wp230obj.dll
WEBDEV - Browser code WDJS.DLL
Java wd230java.jar
Android wd230android.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment