Hello, I'm back again.
Now with more detailed information.
I am not exactly sure what it is you are doing ...
Look at the picture below.
I'm designing a form that lets users to select an item from a list. On the right bottom corner, there is an image 'F1', which means users can press F1 or click on the image.
To let user know that image is clickable, I want it to change color (or perhaps change the image to 'click me') when the mouse pointer is hovering on it. So I need to use OnMouseEnter and OnMouseLeave. Unfortunately OnMouseLeave is not 100% triggered. I tested on Lazarus 2.0.10 GTK2 Ubuntu Mate 20.04.
You have to check if it is the Form is active or take the screen coordinates via application.OnMouseMove.
I can't find TApplication.OnMouseMove. Where to find it?
Changing image is not simple so I wrote a demo that use a TButton instead.
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, Forms, Controls, Graphics, ExtCtrls, StdCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
Shape1: TShape;
procedure Button1MouseEnter(Sender: TObject);
procedure Button1MouseLeave(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button1MouseEnter(Sender: TObject);
begin
Shape1.Brush.Color := clBlue;
end;
procedure TForm1.Button1MouseLeave(Sender: TObject);
begin
Shape1.Brush.Color := clWhite;
end;
end.
Any solution? Workaround? Or maybe suggestion to use other component?