[SOLVED] TPanels Top and Bottom lazarus / 31-LCL ---------------------------------------------------------------------- Pe3s · 2022-09-01 18:25 Hello, I need to add a panel on the top, but then two panels are shown at once, not each panel separately, how can I solve 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 uses LCLIntf; const  ControlPanelHeight = 40;  TopPanelHeight = 32;  procedure TForm1.FormCreate(Sender: TObject);begin  pnControl.Height := 0;TopPanelHeight = 0;end; procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,  Y: Integer);var  P: TPoint;  R: TRect;begin  R := TRect.Create(0, Self.Height - ControlPanelHeight, Self.Width, Self.Height);  P.X := X;  P.Y := Y;  if PtInRect(R, P) then    pnControl.Height := ControlPanelHeight  else    pnControl.Height := 0;end; procedure TForm1.pnControlMouseLeave(Sender: TObject);begin  pnControl.Height := 0;end; ---------------------------------------------------------------------- paweld · 2022-09-01 19:10 I don't know if I understood correctly - you mean hiding Panel1 when pnControl is visible?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.FormCreate(Sender: TObject); begin    pnControl.Visible := False;   Panel1.Visible := True; end;  procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); var   R: TRect; begin   R := Rect(0, Height - pnControl.Height, Width, Height);   pnControl.Visible := R.Contains(Point(X, Y));   Panel1.Visible := not pnControl.Visible; end; ---------------------------------------------------------------------- howardpc · 2022-09-01 19:11 If I have understood the behaviour you are after I think the attached project shows one way to achieve it. ---------------------------------------------------------------------- Pe3s · 2022-09-01 19:47 @ paweld it's about hiding two panels and showing each of them after hovering over the mouse and hiding them after taking the mouse ---------------------------------------------------------------------- paweld · 2022-09-01 20:19 The solution was provided by @howardpc. But you can also do it like thisCode: 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.FormCreate(Sender: TObject); begin   panel1.Visible := False; pnControl.Visible := False; end;  procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin   panel1.Visible := panel1.BoundsRect.Contains(Point(X, Y));   pnControl.Visible := pnControl.BoundsRect.Contains(Point(X, Y)); end; ---------------------------------------------------------------------- KodeZwerg · 2022-09-01 20:49 Idk "the solution" but i would suggest to use Mouse Enter and Leave event. ---------------------------------------------------------------------- paweld · 2022-09-02 04:55 if the panel is not visible then OnMouseEenter will not work ---------------------------------------------------------------------- Pe3s · 2022-09-02 16:40 Hi @paweld what do I have to correct in the code so that there is no error 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.Image32MouseMove(Sender: TObject; Shift: TShiftState; X,  Y: Integer; Layer: TCustomLayer);begin  Toolbar.Visible := Toolbar.BoundsRect.Contains(Point(X, Y));end;   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 unit1.pas(68,57) Fatal: Syntax error, ")" expected but "," found ---------------------------------------------------------------------- Pe3s · 2022-09-02 17:01 Thank you for your help, great beer, gentlemen