unit AdvancedEdit;
interface
uses
Windows, Messages, SysUtils, Classes, Controls, StdCtrls;
type
TAdvancedEdit = class(TEdit)
private
{ Private declarations }
protected
procedure KeyPress(Sender: TObject; var Key: char); override;
{ Protected declarations }
public
{ Public declarations }
published
{ Published declarations }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Samples', [TAdvancedEdit]);
end;
procedure TAdvancedEdit.KeyPress(Sender: TObject; var Key: char);
var AdvancedEdit1: TAdvancedEdit;
begin
if not (key in ['0'..'9', #46, #8]) then
key := #0;
AdvancedEdit1 := TAdvancedEdit.Create(self);
AdvancedEdit1.SelStart := length(AdvancedEdit1.Text);
end;
end.