J
jhb
Unregistered / Unconfirmed
GUEST, unregistred user!
我编了一个简单的空件, EDIT输入回车时,模拟 TAB键,移到下一控件,
但 敲回车就是不能用,请问为什么??
unit Edit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TEdit1 = class(TEdit)
private
procedure KeyPress(var Key: Char);override;
protected
{ Protected declarations }
public
{ Public declarations }
published
{ Published declarations }
end;
procedure Register;
implementation
procedure tedit1.KeyPress(var Key: Char);
begin
if key=#13 then
begin
key:=#0;
perform(cm_dialogkey,vk_tab,0);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
inherited;
end
else inherited;
end;
procedure Register;
begin
RegisterComponents('jhb', [TEdit1]);
end;
end.
但 敲回车就是不能用,请问为什么??
unit Edit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TEdit1 = class(TEdit)
private
procedure KeyPress(var Key: Char);override;
protected
{ Protected declarations }
public
{ Public declarations }
published
{ Published declarations }
end;
procedure Register;
implementation
procedure tedit1.KeyPress(var Key: Char);
begin
if key=#13 then
begin
key:=#0;
perform(cm_dialogkey,vk_tab,0);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
inherited;
end
else inherited;
end;
procedure Register;
begin
RegisterComponents('jhb', [TEdit1]);
end;
end.