Cross-platform get gadget at position
BlitzMax Forums/MaxGUI Module/Cross-platform get gadget at position
| ||
I need a way to retrieve the hwnd/whatever at a position on the screen, in order to implement some drag and drop functionality. In Windows I can use WindowFromPoint(). Is there an equivalent command on MacOS and Linux? Here's my code for Windows. This works, although it does not tell you which item in a treeview is picked. The coordinates have to be in screen coordinates: SuperStrict Import maxgui.drivers ?win32 Import pub.win32 ? ?win32 Extern "win32" Function WindowFromPoint:Int(x:Int,y:Int) EndExtern ? ?win32 Function GetGadgetFromHwnd:TGadget(hwnd:Int) Return TGadget(TWindowsGUIDriver.GadgetMap.valueforkey(TIntWrapper.Create(hwnd))) EndFunction ? Function GetGadgetAtPosition:TGadget(x:Int,y:Int) ?win32 Return GetGadgetFromHwnd(WindowFromPoint(x,y)) ? EndFunction Last edited 2010 Last edited 2010 |