在我的表单中,为了使录入节省时间,不用来回用鼠标,我想一打回车键,光标显示在DBedit上。这个问题怎么解决呀?谢谢!

解决方案 »

  1.   

    在keydown事件中判断是否是回车键
       if key=13 then
       DBedit.setfocus;
      

  2.   

    提示错误:Incompatible type 
    怎么回事呀?麻烦你快告诉我吧!我的程序如下:
    procedure Tptsfdj.FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
     if key=#13 then
       DBedit11.setfocus;end;end.
      

  3.   

    procedure Tptsfdj.edit1Keypress(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
     if key=#13 then
       DBedit11.setfocus;end;
    用keypress.
      

  4.   

    我的editkeypress事件中已经有一条语句了。我要实现的程序是这样的:当打回车键的时候先执行确定按钮(button1),执行了之后光标自动停留在DBedit11里,这样的程序应该怎么写呀!我写的程序不对呀!请高手指点一下!程序如下:
    procedure Tptsfdj.Edit1KeyPress(Sender: TObject; var Key: Char);
    begin
     if key=#13  then   
      button1.Click();
      DBedit11.setfocus;end;
      

  5.   

    能不能这样:
    DBeditl1.setfocus;
    button1.click();
      

  6.   

    这样换不行呀?更糟糕了,edit里不能输入数字了。
      

  7.   

    我要实现的程序是这样的:当打回车键的时候先执行确定按钮(button1),执行了之后光标自动停留在DBedit11里,然后再打回车执行按钮(button2).这样的程序应该怎么写呀!
    怎么没有好心的人告诉我呀?
      

  8.   

    button1的onKeyPress
      加入if key=#13 then Button1.Click;然后在Button1.Click里加入 DBedit11.setfocus;(我想直接加在button1的onKeyPress里应该也没问题的)button2的onKeyPress
      加入if key=#13 then Button2.Click;
      

  9.   

    DBEdit.SetFocus后
    DBedit11里处理onkeydown事件
    xx.Click