Page 1 of 1

Mouse Events

Posted: Mon Jul 28, 2003 6:43 pm
by nci
Does anyone know how to get mouse events for Gadgets?
like if you move the mouse over an image the image will change, or
if you press down or up on a button the image will change also?

I don't want to have to define coords like:

IF mouse > gadgetX and mouse < gadget width ect......

But if this is the only way. I guess i will have to use it :cry:

Also how to you get the mouse coords from the inside of the gadget list
and not the window?

Thanks

Posted: Mon Jul 28, 2003 7:02 pm
by GPI

Code: Select all

Procedure IsMouseOverGadget(Gadget)
  GetWindowRect_(GadgetID(Gadget),GadgetRect.RECT)
  GetCursorPos_(mouse.POINT)
  If mouse\x>=GadgetRect\Left And mouse\x<=GadgetRect\right And mouse\y>=GadgetRect\Top And mouse\y<=GadgetRect\bottom
    ProcedureReturn #True
  Else
    ProcedureReturn #False
  EndIf
EndProcedure
Some note: Windows send a #wm_mousemove, wenn the mouse is moved over one of your windows. (You can get this message with WaitWindowEvent())

Mouse

Posted: Mon Jul 28, 2003 9:10 pm
by nci
Thanks GPI! Works like a charm!