Recent

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

pcurtis

  • Hero Member
  • *****
  • Posts: 951
[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 20H2
Laz 2.2.0
FPC 3.2.2

CM630

  • Hero Member
  • *****
  • Posts: 1082
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Mouse over form
« Reply #1 on: October 20, 2020, 07:55:49 am »
Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

pcurtis

  • Hero Member
  • *****
  • Posts: 951
Re: Mouse over form
« Reply #2 on: October 20, 2020, 09:03:24 am »
Thanks.
Windows 10 20H2
Laz 2.2.0
FPC 3.2.2

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • 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: 3197
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: 11857
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".

 

TinyPortal © 2005-2018