Lazarus

Programming => General => Topic started by: pcurtis on October 20, 2020, 07:12:51 am

Title: [SOLVED] Mouse over form
Post by: pcurtis on October 20, 2020, 07:12:51 am
Hi All,

How can I detect if the mouse is within the forms area?

OnMouseLeave is triggered if the mouse moves over another component on the same form.

Thanks in advance.
Title: Re: Mouse over form
Post by: CM630 on October 20, 2020, 07:55:49 am
Maybe that would help: https://forum.lazarus.freepascal.org/index.php?topic=16843.0
Title: Re: Mouse over form
Post by: pcurtis on October 20, 2020, 09:03:24 am
Thanks.
Title: Re: [SOLVED] Mouse over form
Post by: PascalDragon on October 20, 2020, 09:17:11 am
Don't know if it's mentioned in that thread, but you could also try the OnMouseEnter and OnMouseLeave events of the form.
Title: Re: [SOLVED] Mouse over form
Post by: winni on October 20, 2020, 10:44:11 am
Hi!

 OnMouseEnter and OnMouseLeave  are only triggered if the mouse is inside the area of the form.

If the mouse enters or leaves that area the event is NOT triggered.

Winni
Title: Re: [SOLVED] Mouse over form
Post by: wp on October 20, 2020, 11:08:04 am
The attached demo shows (on Windows - did not test others...) that the OnMouseEnter/Leave events fire whenever the mouse enters/leaves a form or a control, but only the top-most control is considered. This means that when a control covers the form fully (like the memo in the demo after the checkbox has been checked) these events of the form do not fire any more when the mouse is moved into/out of the form horizontally. Only the OnUserInput event of the ApplicationProperties fire whenever the mouse is inside the form, it is some kind of "super-OnMouseMove".
TinyPortal © 2005-2018