How to create an event, the mouse reaches a certain area of the application

1

I am developing an application in delphi xe5 and would like to make a menu open to mouse "enter" in an area of my form.

It's kind of complicated to explain, but I'll try ... The windows taskbar has this option, it is hidden and when you arrive with the mouse where it is (usually below) the bar appears.

I'd like to know how I can implement this in delphi.

    
asked by anonymous 10.07.2014 / 18:53

1 answer

1

A simple way to do this is to handle the onMouseMove event

procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
const
  HEIGHT_TITULO_JANELA = 50;
begin
  pnl1.Visible :=  (Y > (Height - pnl1.Height) - HEIGHT_TITULO_JANELA);

end;

If you want to control the display on the side instead of Bottom, just:

procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
  pnl1.Visible :=  (X < pn1.Width); // para a esquerda
  pnl2.Visible :=  (X > (Width - pnl2.Width)); // para a direita
end;
    
10.07.2014 / 20:27