ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing an application or website / Controls, windows and pages / Controls: Available types / Clickable Image control
  • Overview
  • Retrieving the mouse coordinates
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
Retrieving the coordinates of a click in a clickable image
Overview
If the click action of the image is set to "Server call", you can get the click coordinates when the image is clicked in the browser.
Depending on the mouse position, you can then perform a specific process (change color, display a new image, etc.).
Retrieving the mouse coordinates
The position of the mouse cursor can be retrieved in server code only. To retrieve the position of the mouse cursor, use the following functions:
ImageXPosReturns the horizontal position (X) of the mouse cursor in relation to the specified Image control.
ImageYPosReturns the vertical position (Y) of the mouse cursor in relation to the specified Image control.


Example: Displaying an information box with the mouse position in the clickable image (IMG_Click1).
// -- server code: Click on IMG_Click1
PositionX, PositionY are int
// Retrieve the position of the mouse in a clickable image
PositionX = ImageXPos()
PositionY = ImageYPos()
Info("You've clicked at position: ", PositionX, PositionY)
Remark: You can also use PageParameter with the POS parameter. For example:
// Retrieve the position of the mouse in a clickable image
Parameter is string = PageParameter("POS")
// Ex: Parameter ="15,23"
x,y are int
x = ExtractString(Parameter, 1, ",")
y = ExtractString(Parameter, 2, ",")
Minimum version required
  • Version 9
Comments
Click [Add] to post a comment

Last update: 06/10/2022

Send a report | Local help