在 DBGrid 中按下 enter 鍵將 focus 移到下一個欄位的做法:

procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
{ This is the event handler for the FORM's OnKeyPress event! }
{ You should also set the Form's KeyPreview property to True }
begin
  if Key = #13 then    // if it's an enter key
    if not (ActiveControl is TDBGrid) then 
    begin 
      Key := #0;       // eat enter key 
      Perform(WM_NEXTDLGCTL, 0, 0);  // move to next control
    end
    else if (ActiveControl is TDBGrid) then
    begin 
      with TDBGrid(ActiveControl) do
        if SelectedIndex < (FieldCount -1) then  
          Inc(SelectedIndex);    // increment the field 
        else
          SelectedIndex := 0;
    end;
end;

    Source: geocities.com/huanlin_tsai/faq

               ( geocities.com/huanlin_tsai)