View Issue Details

IDProjectCategoryView StatusLast Update
0036286LazarusLCLpublic2019-11-11 08:21
ReporterPavol S Assigned To 
Status newResolutionopen 
Product Version2.0.7 (SVN) 
Summary0036286: OnMouseLeave / OnMouseEnter is not called
DescriptionWhen scrolling or moving control under mouse OnMouseLeave and OnMouseEnter is not called.
TagsNo tags attached.
Fixed in Revision
Attached Files


Pavol S

2019-11-09 22:07


bug-animation.gif (60,126 bytes)   
bug-animation.gif (60,126 bytes)   

Pavol S

2019-11-09 22:10

reporter   ~0119179

Last edited: 2019-11-09 22:13

View 2 revisions

Test project.

When scolling by keyboard there is no OnMouseEnter/Leave called.
When scrolling by mouse wheel there must be one another move or scroll to property call OnMouseEnter and OnMouseLeave. Bug is not visible when scrolling by small amount of pixels (position). (3,375 bytes)

jamie philbrook

2019-11-09 22:53

reporter   ~0119180

I believe that is the way it works..

 Those events are for mouse movements, you are not moving the mouse but the control itself so there is no mouse messages being generated.

 If you want such an event to happen you can do that in code... drop by in the forums if you wish for help on this.

Pavol S

2019-11-10 07:00

reporter   ~0119183

@jamie philbrook
MouseLeave is called as expected when you switch to another app (ALT + TAB) so there is no mouse movement.

After two mousewheel in same control OnMouseLeave (prev control) and MouseEnter(actual control under mouse) is called (same situation as ALT+TAB there is no real mouse move).

Delphi VCL:
On ALT+TAB - MouseLeave called AND MouseEnter after switch back without mouse move
On manual scrolling - no MouseLeave/Enter
On wheel scrolling - no MouseLeave/Enter

On ALT+TAB - MouseLeave called, but NO MouseEnter after switch back
On manual scrolling - no MouseLeave/Enter
On wheel scrolling - MouseLeave/Enter is called after second call on same control

jamie philbrook

2019-11-10 17:54

reporter   ~0119197

Now you are changing the original report, you are now talking about TABing in / out of controls.

As from what you have described here I don't think those events should be getting called at all when tabbing because unless the mouse actually moves that shouldn't happen.

 I vote to remove the OnMouseLeave when tabbing away from the control if the mouse does not move!

 I don't know what to tell you but I find it strange to have that operate in that manner because it goes against the purpose of the events and that is to track the actual mouse movements.

Pavol S

2019-11-10 20:02

reporter   ~0119202

Maybe I'm wrong, but then this are bugs in LCL? (when MouseLeave/Enter is only for mouse x,y position changing):

procedure TCustomHeaderControl.MouseLeave;
  inherited MouseLeave;
  if not (csDesigning in ComponentState) then
    FMouseInControl := False;
    FDown := False;
    if not FTracking then
      Cursor := FSavedCursor;

procedure TCustomSplitter.MouseEnter;
  inherited MouseEnter;
  if csDesigning in ComponentState then exit;

  if not FMouseInControl and Enabled and (GetCapture = 0) then
    FMouseInControl := True;

Pavol S

2019-11-10 21:38

reporter   ~0119204

LCL controls TToolBar and THeaderControl in test ...
LCL-controls.gif (225,138 bytes)   
LCL-controls.gif (225,138 bytes)   

Thaddy de Koning

2019-11-11 08:21

reporter   ~0119217

If it differs from Delphi behavior I consider this a bug, but I wonder why you need it, because I would program the logic completely different: OnPaint.

Issue History

Date Modified Username Field Change
2019-11-09 22:07 Pavol S New Issue
2019-11-09 22:07 Pavol S File Added: bug-animation.gif
2019-11-09 22:10 Pavol S File Added:
2019-11-09 22:10 Pavol S Note Added: 0119179
2019-11-09 22:13 Pavol S Note Edited: 0119179 View Revisions
2019-11-09 22:53 jamie philbrook Note Added: 0119180
2019-11-10 07:00 Pavol S Note Added: 0119183
2019-11-10 17:54 jamie philbrook Note Added: 0119197
2019-11-10 20:02 Pavol S Note Added: 0119202
2019-11-10 21:38 Pavol S File Added: LCL-controls.gif
2019-11-10 21:38 Pavol S Note Added: 0119204
2019-11-11 08:21 Thaddy de Koning Note Added: 0119217