- Overview
- Retrieving the mouse coordinates
Retrieving the coordinates of a click in a clickable image
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: | | ImageXPos | Returns the horizontal position (X) of the mouse cursor in relation to the specified Image control. | ImageYPos | Returns 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, ",")
|
|
|
|