We need more mouse commands/events!

BlitzPlus Forums/BlitzPlus Programming/We need more mouse commands/events!

JimB wrote this magic little bit of code. Might be a good starting point. But I agree we need events on gadgets other then canvases.

Oh, it lets you query what gadget you're currently over:

.lib "user32.dll"

api_GetCursorPos% (lpPoint*) : "GetCursorPos" 
api_ClientToScreen% (hWnd%,lpPoint*) : "ClientToScreen" 




Type POINTTYPE
	Field x%,y%
End Type
Global point.POINTTYPE=New POINTTYPE

Function MouseOverGadget(gad)

         point\x=0 : point\y=0
	 api_ClientToScreen(QueryObject(gad,1),point)
	 Local gadX%=point\x , gadY%=point\y
	 api_GetCursorPos(point)
	 Local mX%=point\x , mY%=point\y
	 If mX>=gadX And mX<gadX+GadgetWidth(gad)
	         If mY>=gadY And mY<gadY+GadgetHeight(gad)
			 Return True
		 EndIf
	 EndIf

End Function