Or, probably better, get the cursor position and check whether it's still inside the panel's bounding rectangle or has gone out.
Let me see if I can find the specific info to write a small example; this kind of thing is not something I use every day
After some testing ...Ok, here it is. Just an extremely simple example of how to test whether the mouse is still
in the panel, whether over the panel itself or a control inside it:
{Test system: Laz/FPC 2.0.10/3.2.0 x86_64-linux-gtk2}
procedure TForm1.AnyPanelMouseLeave(Sender: TObject);
var
mpos: TPoint;
ThePanel: TPanel;
begin
if (Sender is TPanel) then begin
ThePanel := Sender as TPanel;
mpos := ScreenToClient(Mouse.CursorPos);
if ThePanel.BoundsRect.Contains(mpos) then
ThePanel.Caption := 'Still inside ' + ThePanel.Name
else
ThePanel.Hide;
end;
end;
I tested with a small program with two panels, one of which also had a couple edit controls.
ETA:
Forgot to comment on this:
Works Great but like i said, i don't leave the panel but MouseLeave event gets triggered anyway.
Note that from the mouse's point of view you
do leave the panel to enter another control.
Think about it like this: Imagine, if you will, a big box over a carpet: if you
enter (get into) the box, you
leave (your feet are no longer directly on) the carpet, even if the carpet is still there under the box.
That's the general idea of MouseEnter/MouseLeave*.

Not saying that you're a mouse, o.c.; it's just an example!
