I think it would be something like this:
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, ExtCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
btOk: TButton;
lblMessage: TLabel;
tmClose: TTimer;
procedure tmCloseTimer(Sender: TObject);
private
{ private declarations }
public
class Procedure ShowMessage(aMessage: string);
end;
var
Form1: TForm1;
implementation
procedure TForm1.tmCloseTimer(Sender: TObject);
begin
ModalResult := mrOK;
end;
{$R *.lfm}
{ TForm1 }
class procedure TForm1.ShowMessage(aMessage: string);
begin
with TForm1.Create(nil) do
try
FormStyle := fsStayOnTop;
lblMessage.Caption := aMessage;
tmClose.Enabled := True;
ShowModal;
finally
Free
end;
end;
end.
I put uo timer with interval 3000 which close form after time runs out