MouseLeave on TPanel lazarus / 31-LCL ---------------------------------------------------------------------- Weitentaaal · 2021-02-04 12:07 Hello guys Just wanted to test This : Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Panel2MouseLeave(Sender: TObject);begin  Panel2.Visible:= False;end;  But the Panel has Some TEdit's in it and when i hover over those the Panel MouseLeave Event gets Triggered to0. is there any way to connect those object's ? So the panel gets Invisible when the mouse leaves the Panel, but stay's visible when i hover over a TEdit Field. the Idea: i wanted to create a small Form/Window, wich appears when i click on a Button. On this Panel i can choose between some Informations. After i have choosen 1, the form/window will get Invisible again. But when i just leave it without selecting something it should count as a canceld Operation and the Window/form should close again. Works Great but like i said, i don't leave the panel but MouseLeave event gets triggered anyway. Thanks:) and Excuse my English ---------------------------------------------------------------------- Handoko · 2021-02-04 17:21 That's easy, just make it visible again. Tested on Linux only but it should work on Windows too: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Panel1MouseLeave(Sender: TObject);begin  Panel1.Visible := False;end; procedure TForm1.Edit1MouseEnter(Sender: TObject);begin  Panel1.Visible := True;end; ---------------------------------------------------------------------- lucamar · 2021-02-04 18:32 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: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {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: Quote from: Weitentaaal on February 04, 2021, 01:07:59 pmWorks 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!