J
jiang_yun_2005
Unregistered / Unconfirmed
GUEST, unregistred user!
我想重写onKeyUp事件,可是老出错,请帮忙看一下。
unit TecdsComboBox;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, te_controls;
type
TTecdsComboBox = class(TTeComboBox)
private
{ Private declarations }
FOnKeyPress : TKeyPressEvent;
protected
{ Protected declarations }
procedure KeyPress;Override;
public
{ Public declarations }
constructor Create(AOwner: TComponent);override;
destructor Destroy; override;
published
{ Published declarations }
property OnKeyPress :TKeyPressEvent read FOnKeyPress write FOnKeyPress;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('自定义', [TTecdsComboBox]);
end;
Constructor TTecdsComboBox.Create(AOwner: TComponent);
Begin
inherited Create(AOwner);
End;
Destructor TTecdsComboBox.Destroy;
Begin
inherited Destroy;
End;
procedure TTeScdComboBox.KeyPress();
begin
showmessage('adfd');
inherited KeyPress;
if Assigned(FOnKeyPress) then FOnKeyPress(Self);
end;
end.
unit TecdsComboBox;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, te_controls;
type
TTecdsComboBox = class(TTeComboBox)
private
{ Private declarations }
FOnKeyPress : TKeyPressEvent;
protected
{ Protected declarations }
procedure KeyPress;Override;
public
{ Public declarations }
constructor Create(AOwner: TComponent);override;
destructor Destroy; override;
published
{ Published declarations }
property OnKeyPress :TKeyPressEvent read FOnKeyPress write FOnKeyPress;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('自定义', [TTecdsComboBox]);
end;
Constructor TTecdsComboBox.Create(AOwner: TComponent);
Begin
inherited Create(AOwner);
End;
Destructor TTecdsComboBox.Destroy;
Begin
inherited Destroy;
End;
procedure TTeScdComboBox.KeyPress();
begin
showmessage('adfd');
inherited KeyPress;
if Assigned(FOnKeyPress) then FOnKeyPress(Self);
end;
end.