http://qs321.pair.com?node_id=11143437


in reply to Re^2: Unable to capture mouse events in Win32::Console
in thread Unable to capture mouse events in Win32::Console

It took me a while to figure that one out as well. It's the character-based y coordinate relative to the first (top) line of text in the console, assuming your scroll bar is at the very top. So if your window is 25 lines tall but your history is 50 characters tall total, then if you scroll to the top , it will say the y is line 0, and if you scroll to the bottom, it will say the line is 49.

When I originally had a \n in my ->Write() string, I was confused why the y coordinate would start increasing and "never" stop, even as I moved the cursor back up the screen. So I changed it to a \r instead, so the text wouldn't scroll the screen, and it suddenly made perfect sense, as I manually scrolled or intentionally moved down a line for printing (typing an ENTER, because the keyboard events still kept \n). (I also didn't realize until I did that -- though it should have been obvious, even from the x coordinate -- that the coordinates were in characters, not in pixels.)


update: My original reply was assuming you were talking about the mouse coordinates from @console_events. Sorry I misread. But yes, the current x and current y, in the info array as well, are still relative to the top-left of the whole buffer, so the whole size and current location can be outside the window dimensions.