WindowMouseX( windownr [ , outside ] )

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

WindowMouseX( windownr [ , outside ] )

Post by blueznl »

An optional flag for WindowMouseX() and WindowMouse(Y) which would allow reporting of mouse coordinates outside the window.

Example:

A viewer application is open but not full screen. The user pans over a large image, by clicking then dragging the mouse. The mouse events are captured using setcapture. When the mouse leaves the application window, in the current implementation of WindowMouseX() the returned coordinate changes to -1. It would be nice if, when setting the flag to true, it would report the coordinates relative to the window interior, ie. when, for example, 20 pixels left and above the window interior it should report -20 for x, - 20 for y, if the outside flag would be set to true.

This could be simulated by using DesktopMouseX(), but as the relation between WindowMouseX() and DesktopMouseX() is unknown (as it is OS depending) resulting code would not be platform independant.

(But feel free to post your workaround here :-) One of them is calculating dx = DesktopMouseX() - WindowMouseX() and then only keep using DesktopMouseX() - x :-))
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )