就是输入页面中,我输入了一个DBEDIT中的内容后按回车后,光标就到下个DBEDIT

解决方案 »

  1.   

    //Form1.KeyPreview := True;
    procedure TForm1.FormKeyDown(Sender: TObject ........);
    begin
      case Key of
        VK_RETURN: Perform(wm_nextdlgctl, 0, 0); 
      end;
    end;
      

  2.   

    在窗体的keypress事件里写
    if key=13 then
    if activecontrol is tedit then 
    selectnext(activecontrol,true,true);
    然后把窗体的keypreview属性设为true
      

  3.   

    在前一个DBEdit1的OnKeyPress事件中判断
    if Key = 13 then SetFocusControl(DBEdit2);
      

  4.   

    to GreensPan(GreensPan):
      有N个DBEdit就要写N个吗?
      

  5.   

    procedure TForm.DBEdit1OnKeyPress(......);
    begin
    if Key = 13 then SetFocusControl(DBEdit2); 
    end;cprocedure TForm.DBEdit2OnKeyPress(......);
    begin
    if Key = 13 then SetFocusControl(DBEdit3); 
    end;procedure TForm.DBEdit3OnKeyPress(......);
    begin
    if Key = 13 then SetFocusControl(DBEdit4); 
    end;procedure TForm.DBEdit4OnKeyPress(......);
    begin
    if Key = 13 then SetFocusControl(DBEdit5); 
    end;//...........
      

  6.   

    如果控件中有DBCOMBOBOX还能用吗?
    if Key = 13 then SetFocusControl(DBcombobox);
    ???? 
      

  7.   

    //你就不会试试吗?
    procedure TForm1.FormCreate(Sender: TObject);
    begin
      KeyPreview := True;
    end;procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
      case Key of
        VK_RETURN: Perform(WM_NEXTDLGCTL, 0, 0);
      end;
    end;
      

  8.   

    //pas
    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;
        Edit5: TEdit;
        Edit6: TEdit;
        procedure FormCreate(Sender: TObject);
        procedure FormKeyDown(Sender: TObject; var Key: Word;
          Shift: TShiftState);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
    begin
      KeyPreview := True;
    end;procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
      case Key of
        VK_RETURN: Perform(WM_NEXTDLGCTL, 0, 0);
      end;
    end;end.//dfm
    object Form1: TForm1
      Left = 192
      Top = 103
      Width = 544
      Height = 375
      Caption = 'Form1'
      Color = clBtnFace
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      OldCreateOrder = False
      OnCreate = FormCreate
      OnKeyDown = FormKeyDown
      PixelsPerInch = 96
      TextHeight = 13
      object Edit1: TEdit
        Left = 56
        Top = 16
        Width = 121
        Height = 21
        TabOrder = 0
        Text = 'Edit1'
      end
      object Edit2: TEdit
        Left = 200
        Top = 16
        Width = 121
        Height = 21
        TabOrder = 1
        Text = 'Edit2'
      end
      object Edit3: TEdit
        Left = 72
        Top = 80
        Width = 121
        Height = 21
        TabOrder = 2
        Text = 'Edit3'
      end
      object Edit4: TEdit
        Left = 216
        Top = 48
        Width = 121
        Height = 21
        TabOrder = 3
        Text = 'Edit4'
      end
      object Edit5: TEdit
        Left = 64
        Top = 144
        Width = 121
        Height = 21
        TabOrder = 4
        Text = 'Edit5'
      end
      object Edit6: TEdit
        Left = 216
        Top = 112
        Width = 121
        Height = 21
        TabOrder = 5
        Text = 'Edit6'
      end
    end
      

  9.   

    给你一个,可以在整个工程里用回车键代替Tab键
    在主窗体中定义一个过程
    procedure TMain_Form.DoEnterAsTab(var Msg: TMsg; var Handled: Boolean);
    begin
      if Msg.Message = WM_KEYDOWN then
      begin
        if Msg.wParam = VK_RETURN then
          Keybd_event(VK_TAB, 0, 0, 0);
      end; 
    end;
    在FormCreate中这么引用
    Application.OnMessage := DoEnterAsTab;