Das Event musst du auch als Property definieren. Die Variable im Public muss da weg ins Private und dafür im Published ein Property OnTimerDelayed einfügen:
Delphi-Quellcode:
unit TTextBoxDelay;
interface
uses
System.SysUtils, System.Classes, FMX.Types, FMX.Controls, FMX.Objects, FMX.Edit;
type
TTimerHandlerEvent =
procedure(
const aSearchText:
string)
of object;
TTextExtension =
class(TEdit)
private
FOnTimerDelayed: TTimerHandlerEvent;
procedure TimerHandler(Sender: TObject);
public
constructor Create(AOwner: TComponent);
override;
published
property OnTimerDelayed: TTimerHandlerEvent
read FOnTimerDelayed
write FOnTimerDelayed;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('
Standard', [TTextExtension]);
end;
constructor TTextExtension.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
end;
procedure TTextExtension.TimerHandler(Sender: TObject);
begin
if Assigned(FOnTimerDelayed)
then begin
FOnTimerDelayed(searchText);
end;
end;
end.