unit DdhInpuB; interface {$R *.DCR} uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TDdhInputButton = class(TButton) private procedure WmChar (var Msg: TWMChar); message wm_Char; end; procedure Register; implementation procedure TDdhInputButton.WmChar (var Msg: TWMChar); var Temp: String; begin if Char (Msg.CharCode) = #8 then begin // if backspace, remove last char Temp := Caption; Delete (Temp, Length (Temp), 1); Caption := Temp; end else // add the char Caption := Caption + Char (Msg.CharCode); end; procedure Register; begin RegisterComponents('DDHB', [TDdhInputButton]); end; end.