如何按下enter键来实现tab的功能,比如填写数据时,填完这一项,再移到下个edit上填写,按enter键就可以,这怎么实现啊?我时初学者。

解决方案 »

  1.   

    TForm1的KeyPreview设置为true.
    procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
    begin
     if (Key = #13) then
     begin
      key := #0;
      Perform(WM_NEXTDLGCTL, 0, 0);
     end;
    end;
      

  2.   

    TForm1的KeyPreview设置为true.
    procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
    begin
     if (Key = #13) then
     begin
      key := #0;
      edit1.setfource;
     end;
    end;
      

  3.   

    正确答出来了,结帐吧,强烈你问前serch一下。
      

  4.   

    就20分还这么多人争阿
    还有一个办法就是模拟按TAB键
    就不写了
      

  5.   

    我按照你们说的作了,客还是不行啊,只有tab键能将光标,enter 不管用。
      

  6.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm1 = class(TForm)
        Edit1: TEdit;
        Edit2: TEdit;
        Edit3: TEdit;
        Edit4: TEdit;
        Button1: TButton;
        procedure formkeypress(sender:Tobject;var key:char);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation
    procedure Tform1.formkeypress(sender:Tobject;var key:char);
    begin
    if (key=#13) then
    begin
    key:=#0;
    perform(wm_nextdlgctl,0,0);
    end;
    end;
    end.
    enter键不管用,请指点。谢谢。