There are basically 2 ways to do it. The easy and the hard ways.
The hard way is the best. You write your own component, add all the features you want. Just that simple, but the code will be very complex if you never write a component.
I guess you choose the easy one.
You need a TPanel and a TImage. Why TPanel? Without TPanel, the image will hide behind the TEdit.
1. Put a TImage inside a TPanel.
2. Resize them properly.
3. The TPanel.Height should be at least 4 pixels smaller than TEdit.Height
4. Position the TPanel properly above the TEdit.
5. Set the TEdit's OnEnter and OnExit events to hide/show the TPanel.
You can download the test.zip.
Note:
I tested the code using Lazarus 1.6.4 Gtk2 on Ubuntu Mate 16.10. The appeareance may be different if you switch to other desktop themes. Also, on Windows, the results will be much different, because Windows default TEdit.Height is not the same as on Linux.
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Forms, Controls, StdCtrls, ExtCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Image1: TImage;
Label1: TLabel;
Label2: TLabel;
Panel1: TPanel;
procedure Edit1Enter(Sender: TObject);
procedure Edit1Exit(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Edit1Exit(Sender: TObject);
begin
Panel1.Visible := True;
end;
procedure TForm1.Edit1Enter(Sender: TObject);
begin
Panel1.Visible := False;
end;
end.