Recent

Author Topic: [SOLVED] Mouse over form  (Read 329 times)

pcurtis

  • Sr. Member
  • ****
  • Posts: 351
[SOLVED] Mouse over form
« 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.
« Last Edit: October 20, 2020, 09:03:59 am by pcurtis »
Windows 10 / Linux Mint 20
Laz 2.10.0
FPC 3.2.0

CM630

  • Hero Member
  • *****
  • Posts: 918
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Mouse over form
« Reply #1 on: October 20, 2020, 07:55:49 am »
Лазар 2,0,10; W10 or W7 64bit; FPC3,2,0; rev 63526

pcurtis

  • Sr. Member
  • ****
  • Posts: 351
Re: Mouse over form
« Reply #2 on: October 20, 2020, 09:03:24 am »
Thanks.
Windows 10 / Linux Mint 20
Laz 2.10.0
FPC 3.2.0

PascalDragon

  • Hero Member
  • *****
  • Posts: 2418
  • Compiler Developer
Re: [SOLVED] Mouse over form
« Reply #3 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.

winni

  • Hero Member
  • *****
  • Posts: 2000
Re: [SOLVED] Mouse over form
« Reply #4 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

wp

  • Hero Member
  • *****
  • Posts: 7737
Re: [SOLVED] Mouse over form
« Reply #5 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".
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

 

TinyPortal © 2005-2018