Registriert seit: 31. Okt 2003
1.120 Beiträge
Delphi 7 Personal
|
Re: Hinzufügen von neuen Ereignissen zu Komponenten
1. Nov 2003, 19:17
Wie wärs damit:
Delphi-Quellcode:
type
TDigitLedMouseDownEvent = procedure(Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
TDigitLed = class(TPaintBox)
private
...
protected
{ Protected declarations }
...
FOnMouseDown : TDigitLedMouseDownEvent;
procedure MouseDown(Button: TMouseButton;
Shift: TShiftState; X, Y: Integer); override;
public
{ Public declarations }
...
published
{ Published declarations }
...
property OnMouseDown : TDigitLedMouseDownEvent read FOnMouseDown write FOnMouseDown;
end;
procedure Register;
implementation
{$R DIGITLED.DCR}
procedure Register;
begin
RegisterComponents('MoonRed', [TDigitLed]);
end;
...
procedure TDigitLed.MouseDown(Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
inherited;
If Assigned(FOnMouseDown) then
FOnMouseDown(Button, Shift, X, Y);
end;
|
|
Zitat
|