This is adapted from a method I found from a code snippet in the forum. I thought it would be useful enough to post here.
Code: Select all
OpenWindow(0,0,0,320,240,"",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
CreateGadgetList(WindowID(0))
gadget=Frame3DGadget(#PB_Any, 10, 10, WindowWidth(0)-20, WindowHeight(0)-20, "", #PB_Frame3D_Flat)
	
Repeat
event=WaitWindowEvent()
If event
	GetCursorPos_(@cp.point)
	GetWindowRect_(GadgetID(gadget),gr.RECT)
	If PtInRect_(@gr, cp\x, cp\y)
		If GetAsyncKeyState_(#VK_LBUTTON)&32768
			Debug Str(cp\x-gr\left)+"\"+Str(cp\y-gr\top)
		EndIf
	EndIf
EndIf
Until event=#PB_Event_CloseWindow

