网上找了一个例子。但是报错,例子如下:
--------------------------------------------------------------------
procedure TAppbarMain.FormKeyPress(Sender: TObject; var Key: Char);
begin
if(Key=VK_RETURN) then
begin
SendMessage(Handle,WM_NEXTDLGCTL,0,0);
Key:=0;
end;
end;
----------------------------------------------------------------------
报错信息;
[Error] djwh.pas(176): Incompatible types
[Error] djwh.pas(179): Incompatible types: 'Char' and 'Integer'
[Fatal Error] yhwg.dpr(32): Could not compile used unit 'djwh.pas'谢谢!!!!
--------------------------------------------------------------------
procedure TAppbarMain.FormKeyPress(Sender: TObject; var Key: Char);
begin
if(Key=VK_RETURN) then
begin
SendMessage(Handle,WM_NEXTDLGCTL,0,0);
Key:=0;
end;
end;
----------------------------------------------------------------------
报错信息;
[Error] djwh.pas(176): Incompatible types
[Error] djwh.pas(179): Incompatible types: 'Char' and 'Integer'
[Fatal Error] yhwg.dpr(32): Could not compile used unit 'djwh.pas'谢谢!!!!
那你就
if(Key=VK_RETURN) then
dbedit2.setfocus;
就行了
dbedit2的TabOrder<>dbedit1.TabOrder+1,那么dbedit2不会立刻获得焦点。if(Key=VK_RETURN) then
修改成
if Key=Char(VK_RETURN) then给你推荐一个控件 DosMove,蛮好用的。