我设计的一个界面,有两个文本框,分别是edit1、edit2,一个按钮
我想在edit1中输入过内容之后,按回车键,光标移到edit2,请问怎么实现?

解决方案 »

  1.   

    在edit1的keypress事件中写
    if key=#13 then 
     edit2.setfocus;
      

  2.   

    简单的方法:在Edit1.KeyPressed事件下,判断按键是否为回车键,然后执行 Edit2.Focus 方法。可以查一下以前的帖子,有很多这样的提问。
      

  3.   

    在editonkeypress中,
    if key=#13 then
      edit2.setfocus;
      

  4.   

    在edit1的onkeypress事件中
            if key=#13 then
                   edit1.setfocus; 或 activecontrol:=edit1;
      

  5.   

    不管你有多少个文本框都可以。
    if Key = #13 then
    begin
       SendMessage(this.Handle,WM_NEXTDLGCTL,0,0);
       Key := 0;
    end;