Is there a way to *get* the mouse position values that you can set with MoveMouse()?
DesktopMouseX/Y?
BlitzMax Forums/BlitzMax Beginners Area/DesktopMouseX/Y? GadgetX(Desktop()) ought to work, but last time I checked, it didn't.
Strict Local window:TGadget window=CreateWindow("My Window",40,40,320,240) Local P:TGadget = CreatePanel(0,0,ClientWidth(window),ClientHeight(window),Window,PANEL_ACTIVE) While True WaitEvent Print CurrentEvent.ToString() Select EventID() Case EVENT_WINDOWCLOSE End Case EVENT_MOUSEMOVE SetStatusText(window,EventX()+ ":" + EventY() ) Case EVENT_WindowSize SetGadgetShape(P,0,0,ClientWidth(window),ClientHeight(window)) End Select Wend
No, no, not inside the application window - on the Desktop. I want to move a window to where the mouse is, and to do that I need the mouse's co-ordinates relative to the top left corner of the screen. Adding GadgetX/Y to window co-ordinates won't help because it won't be offset by the size of the window title bar/edge. There should be a way to do this, MoveMouse can *set* the values.
Edit: Also, klepto:
Another way to do this (though you might already know and prefer to do it your way) is:
...once, after you create it.
Edit: Also, klepto:
Case EVENT_WindowSize SetGadgetShape(P,0,0,ClientWidth(window),ClientHeight(window))
Another way to do this (though you might already know and prefer to do it your way) is:
SetGadgetLayout P,EDGE_ALIGNED,EDGE_ALIGNED,EDGE_ALIGNED,EDGE_ALIGNED
...once, after you create it.
Yes, I alread know that, but forget it with this sample.
Maybe, this is what you are looking for:
Win32 only:
Maybe, this is what you are looking for:
Win32 only:
Strict Local window:TGadget Global PT: POINT = New POINT GetCursorPos_( pt ) window=CreateWindow("My Window",pt.x,pt.y,200,300) While True GetCursorPos_( pt ) SetStatusText(Window,pt.x + " : " + pt.y) WaitEvent Print CurrentEvent.ToString() Select EventID() Case EVENT_WINDOWCLOSE End End Select Wend ?Win32 Extern "Win32" Function GetCursorPos_(lpPoint:Byte Ptr) = "GetCursorPos@4" End Extern ? Type POINT Field x% Field y% End Type
Aha! Yeah, that looks like it, thank you. Surely Cocoa and FLTK have equivalent functions, this should be made an official function...
What about getting the screen position of gadgets, is that as easy? I suppose I could iterate back through using GadgetGroup(), adding up all the GadgetX()'s, but that would still have the titlebar/sidebar problem.