unit MyTestComponent;
interface
uses
Windows, SysUtils, Classes, Controls, ExtCtrls, Dialogs, TypInfo;
type
TMyTestComponent =
class(TPaintBox)
private
{ Private-Deklarationen }
FText:
String;
function Conv(C: TComponentState):
String;
procedure SetText(Value:
String);
protected
{ Protected-Deklarationen }
public
{ Public-Deklarationen }
constructor Create(AOwner: TComponent);
override;
procedure AfterConstruction;
override;
procedure Loaded;
override;
published
{ Published-Deklarationen }
property Text:
String read FText
write SetText;
end;
procedure Register;
implementation
function TMyTestComponent.Conv(C: TComponentState):
String;
begin
Result := SetToString(PTypeInfo(TypeInfo(TComponentState)), Word(C), True)
end;
procedure TMyTestComponent.SetText(Value:
String);
begin
OutputDebugString(PChar(Format('
TMyTestComponent.SetText(%d) = "%s" %s',
[Integer(Self), Value, Conv(ComponentState)])));
MessageBox(0, PChar(Format('
TMyTestComponent.SetText(%d) = "%s" %s',
[Integer(Self), Value, Conv(ComponentState)])),
nil, 0);
end;
constructor TMyTestComponent.Create(AOwner: TComponent);
begin
inherited;
FText := '
abcdef';
OutputDebugString(PChar(Format('
TMyTestComponent.Create(%d) %s',
[Integer(Self), Conv(ComponentState)])));
MessageBox(0, PChar(Format('
TMyTestComponent.Create(%d) %s',
[Integer(Self), Conv(ComponentState)])),
nil, 0);
end;
procedure TMyTestComponent.AfterConstruction;
begin
inherited;
OutputDebugString(PChar(Format('
TMyTestComponent.AfterConstruction(%d) %s',
[Integer(Self), Conv(ComponentState)])));
MessageBox(0, PChar(Format('
TMyTestComponent.AfterConstruction(%d) %s',
[Integer(Self), Conv(ComponentState)])),
nil, 0);
end;
procedure TMyTestComponent.Loaded;
begin
inherited;
OutputDebugString(PChar(Format('
TMyTestComponent.Loaded(%d) %s',
[Integer(Self), Conv(ComponentState)])));
MessageBox(0, PChar(Format('
TMyTestComponent.Loaded(%d) %s',
[Integer(Self), Conv(ComponentState)])),
nil, 0);
end;
procedure Register;
begin
RegisterComponents('
himitsu', [TMyTestComponent]);
end;
end.