Task

Get the current location of the mouse cursor relative to the active window.

Please specify if the window may be externally created.




 
Module Checkit {
	\\ works when console is the active window
	\\ pressing right mouse button exit the loop
	While mouse<>2
		Print mouse.x, mouse.y
	End While
	\\ end of part one, now we make a form with title Form1 (same name as the variable name)
	Declare Form1 Form
	Layer Form1 {
		window 16, 10000,8000  ' 16pt font at maximum 10000 twips x 8000 twips
		cls #335522, 1 \\ from 2nd line start the split screen (for form's layer)
		pen 15 ' white
	}
	Function Form1.MouseMove {
		Read new button, shift, x, y  ' we use new because call is local, same scope as Checkit.
		Layer Form1 {
			print x, y, button
			refresh
		}
	}
	Function Form1.MouseDown {
		Read new button, shift, x, y
		\\ when we press mouse button we print in console
		\\ but only the first time
		print x, y, button
		refresh
	}
	\\ open Form1 as modal window above console
	Method Form1, "Show", 1
	Declare Form1 Nothing
}
CheckIt
 