mousex(), mousey()
BlitzMax Forums/BlitzMax Programming/mousex(), mousey()
| ||
How do I get the mouse-on-screen coordinates with maxgui? Not using classic Graphics, just a maxgui-window here. I want to make my own dragbar in my own window. Made it before in B+, went well.. it's just that I need the mouseposition on the screen in maxgui..! |
| ||
Check for the mousemove event, it holds the mouse position. |
| ||
Global MX:Int Global MY:Int Select EventID() Case Event_MouseMove MX=EventX() MY=EventY() End Select This is just meant to put you on the right track. Hope it helps. |
| ||
Eric: doesn't work. I need the mousecoord on the screen, not the coordinate on a canvas/panel, just the way it worked in B+! I need to compare my canvas-x/y with the screen x/y, that's why I need screencoords. :P |
| ||
oh I misunderstood.. Does EnablePolledInput() Work? nope...I just tried it. |
| ||
nope, besides I refuse any polling on this planet. Events it will be and stay.. :P |
| ||
Think you need GetCurrentPositionEx() |
| ||
where to find/how to use? |
| ||
Ok, it's in msdn, more specific then: "how to use?"BOOL GetCurrentPositionEx( HDC hdc, // handle to device context LPPOINT lpPoint // current position ); and: typedef struct tagPOINT { LONG x; LONG y; } POINT, *PPOINT; * no experience with all this.. :P |
| ||
Type TPoint Field X Field Y End Type Function ccGetCursorPos:TPoint() 'Returns a TPoint ?Win32 Local point:TPoint = New TPoint If Not GetCursorPos(point) Then ccRunTimeError ("Error Getting Cursor Pos") Return Null Else Return point EndIf ? End Function This get's it relative to the desktop top left, not sure if it helps. BUT you can work out your window (or client area) top left and calc the X Y in the app. All part of my Game Framework ;-) |
| ||
erhm, what's GetCursorPos ? :P And is it multi-platform anyway? |
| ||
oops:?win32 Extern "win32" Function GetCursorPos%(point: Byte Ptr) End Extern ? and um ... the win32 answers your second question... Anyway, I posted that cos the MSDN code you posted is Windows based too ... Big ;-p |
| ||
hm, dunno if it works.. it only returns the 'screencoord' from a canvas, not just the coord of 'whatever'.. have to try. Anyway, the classic mousex() and mousey() from B+ are lost it seems.. |
| ||
what only returns screen coord from a convas? My code returns relative to the desktop for sure I use it! |
| ||
hm.. I don't think it works.. it bugs.. and it's more or less 1:1 c/p'ed from a B+ source where it worked.. Bottomline: someone oughta bring back the mousex/y from the grave, where they'll work everywhere on screen.., in any circumstances! |