当edit1内容输入完后,按下回车,如何实现将输入光标自动调转到edit2?

解决方案 »

  1.   

    在edit1的onkeydown事件中
      if key=13 then
        if edit2.canfocus then
           edit2.setfocus;
      

  2.   

    楼上的错了是: if key=#13 then
        if edit2.canfocus then
           edit2.setfocus;
      

  3.   

    这样,如果有很多Edit 的话就不好了。用消息:
    procedure TfrmBase.FormKeyPress(Sender: TObject; var Key: Char);
    begin
      if (Key = #13) and (not ((ActiveControl is TCustomGrid) or (ActiveControl.Parent is TCustomGrid))) then
      begin
        Key := #0; 
        SendMessage(Self.Handle, WM_NEXTDLGCTL, 0, 0);
      end;
    end;
      

  4.   

    这是DELPHI比较麻烦的地方。必须要用代码实现
      

  5.   

    楼上的更通用!!
    但要注意控件的tag一定要按顺序设置好。揭帖。
      

  6.   

    Edit1的KeyDown中:
    if Key = #13 then
       Edit2.SetFoucs;
      

  7.   

    hydonlee(青山情) 's is good!
    study