DDHCNTED.PAS
unit DdhCntEd;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
{$R *.DCR}
type
TDdhCountEdit = class(TEdit)
private
FLabel: TLabel;
procedure SetCountLabel (Value: TLabel);
protected
procedure Notification(AComponent: TComponent;
Operation: TOperation); override;
procedure Change; override;
published
property CountLabel: TLabel
read FLabel write SetCountLabel;
end;
procedure Register;
implementation
procedure TDdhCountEdit.SetCountLabel (Value: TLabel);
begin
if Value <> FLabel then
begin
FLabel := Value;
FLabel.Caption := IntToStr (Length (Text));
FLabel.FreeNotification (self);
end;
end;
procedure TDdhCountEdit.Change;
begin
inherited Change;
if Assigned (FLabel) then
FLabel.Caption := IntToStr (Length (Text));
end;
procedure TDdhCountEdit.Notification(AComponent: TComponent;
Operation: TOperation);
begin
inherited Notification(AComponent, Operation);
if (Operation = opRemove) and (AComponent = FLabel) then
FLabel := nil;
end;
procedure Register;
begin
RegisterComponents('DDHB', [TDdhCountEdit]);
end;
end.
Generated by PasToWeb, a tool by Marco Cantù.