PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
  • Error
  • Miscellaneous
  • Limits in browser code
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Used in an linked event with the mouse or stylus (click code, hover code, left or right button pressed code, ...) returns the vertical position (Y) of the mouse cursor in relation to the control or the window considered.
You can find out:
  • the position of the mouse (or the stylus) when left clicking in an Image control (function used in the "Click" event of the Image control)
  • the position of the mouse (or stylus) when hovering over a window (function used in the optional "Mouse hover" event of a window)
WEBDEV - Browser code Used in a browser event (of an control or a page), returns the vertical position (Y) of the mouse cursor according to the specified marker.
Remarks:
  • WINDEV The position of the mouse can also be known with the CursorPos function. CursorPos should only be used to modify the mouse position.
  • Universal Windows 10 AppAndroidJava It is advisable to use this function only in events in fields hovered with the mouse.
  • Universal Windows 10 AppAndroid MouseYPos returns the last known position of finger on the device screen.
Versions 16 and later
Android This function is now available for Android applications.
Universal Windows 10 App This function is now available for Windows Phone applications.
New in version 16
Android This function is now available for Android applications.
Universal Windows 10 App This function is now available for Windows Phone applications.
Android This function is now available for Android applications.
Universal Windows 10 App This function is now available for Windows Phone applications.
Versions 17 and later
iPhone/iPad This function is now available for iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for iPhone/iPad applications.
iPhone/iPad This function is now available for 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 QueriesJavaUser code (UMC)
// Survol souris de la fenêtre "FEN_Dessin"
// Code optionnel de la fenêtre
Message("Position de la souris: X: "  + MouseXPos() + " Y: " + MouseYPos())
WINDEVReports and QueriesUniversal Windows 10 AppAndroidiPhone/iPadIOS WidgetMac CatalystJavaUser code (UMC)
// Affiche un message différent selon l'endroit cliqué
IF MouseYPos() < 25 THEN
Info("En haut")
ELSE
Info("En bas")
END
WEBDEV - Browser code
// Survol souris de la page "Dessin"
// Code optionnel de la page
// Souris déplacée (onmousemove)
Message("Position de la souris: X: " + MouseXPos(mpPage) + " Y: " + MouseYPos(mpPage))
Syntax
WINDEVReports and QueriesUniversal Windows 10 AppAndroidiPhone/iPadIOS WidgetMac CatalystJavaUser code (UMC)

Retrieving the mouse position in a window Hide the details

<Result> = MouseYPos([<Marker>])
<Result>: Integer
  • Vertical position (or Y-coordinate) of 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
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).
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).

This constant should only be used when the MouseYPos function is called in an event associated with an Image control. Otherwise, the function MouseYPos will return -1.

Universal Windows 10 App This parameter is not available.
New in version 17
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).
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).

This constant should only be used when the MouseYPos function is called in an event associated with an Image control. Otherwise, the function MouseYPos will return -1.

Universal Windows 10 App This parameter is not available.
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).
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).

This constant should only be used when the MouseYPos function is called in an event associated with an Image control. Otherwise, the function MouseYPos will return -1.

Universal Windows 10 App This parameter is not available.
WEBDEV - Browser code

Retrieving the mouse position in a page Hide the details

<Result> = MouseYPos([<Marker>])
<Result>: Integer or real
  • Vertical position (or Y-coordinate) of 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
Indicates the 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, MouseYPos must be used in the "OnClick" code of 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 QueriesUniversal Windows 10 AppAndroidiPhone/iPadIOS WidgetMac CatalystJavaUser code (UMC)

Error

The main error codes are as follows:
  • No window is opened.
  • No mouse click is performed.
  • The MouseYPos function is not called in an linked mouse event.
  • The click code is executed by function Execute or ExecuteProcess.
WINDEVReports and QueriesUniversal Windows 10 AppAndroidiPhone/iPadIOS WidgetMac CatalystJavaUser code (UMC)

Miscellaneous

  • The horizontal position of mouse (or stylus) is returned by MouseXPos.
  • MouseYPos used in the selection code of row or table always returns 0.
WEBDEV - Browser code

Limits in browser code

MouseYPos is not available:
  • in browser procedures.
  • in the events directly or indirectly called from a browser procedure (via ExecuteProcess for example).
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
Component: wd270obj.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment