S
shbjkl
Unregistered / Unconfirmed
GUEST, unregistred user!
unit myedit;
interface
uses
Windows, Messages, SysUtils, Classes, Controls, StdCtrls;
type
Tmyedit = class(TEdit)
private
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
published
//constructor Create (AOwner: TComponent); override;
procedure KeyPress(Sender: TObject; var Key: Char);override;
{ Published declarations }
end;
//procedure Tmyflatedit1.Keypress(Sender:TObject; var Key:char);override;
procedure Register;
implementation
procedure KeyPress(Sender: TObject; var Key: Char);
begin
inherited;
if not (key in['0'..'9',#46,#8,'.','-']) then
begin
key:=#0;
end;
end;
procedure Register;
begin
RegisterComponents('standard', [tmyedit]);
end;
end.
报错:Declaration of 'KeyPress' differs from previous declaration
interface
uses
Windows, Messages, SysUtils, Classes, Controls, StdCtrls;
type
Tmyedit = class(TEdit)
private
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
published
//constructor Create (AOwner: TComponent); override;
procedure KeyPress(Sender: TObject; var Key: Char);override;
{ Published declarations }
end;
//procedure Tmyflatedit1.Keypress(Sender:TObject; var Key:char);override;
procedure Register;
implementation
procedure KeyPress(Sender: TObject; var Key: Char);
begin
inherited;
if not (key in['0'..'9',#46,#8,'.','-']) then
begin
key:=#0;
end;
end;
procedure Register;
begin
RegisterComponents('standard', [tmyedit]);
end;
end.
报错:Declaration of 'KeyPress' differs from previous declaration