怎样实现点击回车键使光标从一个文本框跳到另一个文本框?

解决方案 »

  1.   

    OnKeyPress事件中写
    if Key = #13 then Edit.Setfocus
      

  2.   

    真受不了
    if Key = #13 then button.Setfocus
      

  3.   

    也是一样的啊,如楼主所说。if Key = #13 then button.Setfocus
      

  4.   

    TSpeedButton里面有Setfocus事件吗?
      

  5.   

    TSpeedButton里面有Setfocus方法吗?
      

  6.   

    WinControl.setFocus;
    最通用的了
      

  7.   


    procedure TForm1.FormCreate(Sender: TObject);
    begin
     self.KeyPreview := true;
    end;procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    var
      obj:twincontrol;
    begin
      obj := self.ActiveControl;
      if key=13 then selectnext(obj,true,true);
    end;
      

  8.   

    if (KeyPreview = true ) and (Key = #13 )then
      begin
        Key := #0;
        perform(WM_NEXTDLGCTL,0,0);
      end;跳到下一个可以接受焦点的控件上
    相当于 Tab 键
      

  9.   

    回車鍵是點擊的嗎?
    不過
    if (KeyPreview = true ) and (Key = #13 )then
      begin
        Key := #0;
        perform(WM_NEXTDLGCTL,0,0);
      end;
    這可能是你要的意思吧。
      

  10.   

    edit1_OnKeyPress事件
    if key=#13 then edit2.setfocus控件写了“.”后面能有提示出来就有
      

  11.   

    procedure TFrm_gsfather.FormKeyPress(Sender: TObject; var Key: Char);
    begin
      if (key = #13) or (key = #40) then
        SelectNext(ActiveControl,true,true);end;
      

  12.   


    procedure TWinControl.SelectNext(CurControl: TWinControl;
      GoForward, CheckTabStop: Boolean);
    begin
      CurControl := FindNextControl(CurControl, GoForward,
        CheckTabStop, not CheckTabStop);
      if CurControl <> nil then CurControl.SetFocus;
    end;