来自:beta 时间:99-10-15 00:11:48 ID:142106
先将TForm1的KeyPreview设置为true.
然后加入:
procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
if (Key = #13) then
begin
key := #0;
Perform(WM_NEXTDLGCTL, 0, 0);
end;
end;
--------------------------------------------------------------------------------
来自:wuhee 时间:99-10-19 15:33:30 ID:143611
可用一函数:
如:
假设Form1有:
Edit1:Tedit;
Edit2:TEdit;
要在此连控件中实现焦点切换:
procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Key=vk_Return then
PostMessage(0,VK_Tab,0,0);//like the 'tab' button pressed.
end;