unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    procedure Edit1KeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
  if  Key=#9 then
  begin
    Key:=#13;
    Edit3.SetFocus;
  end;
 if Key=#13  then
 begin
   Edit3.SetFocus;
 end;
end;end.

解决方案 »

  1.   

    没这么麻烦,,procedure TSysBaseEditForm.FormKeyPress(Sender: TObject; var Key: Char);
    begin
      if (Key=#13) and (ActiveControl.Tag<>100) then     //同时将KeyPreview属性设为True
      begin
        Key:=#0;
        Perform(WM_NEXTDLGCTL,0,0);
      end;
    end;并设定FORM的//同时将KeyPreview属性设为True,及设置控件的TABORDER次序
      

  2.   

    FORM事件列表中,找到KeyPress事件双击进去并设定FORM的KeyPreview属性设为TrueTABORDER次序0.1.2.3.4
    我一直是这样用的,绝对没有问题
      

  3.   

    这样做 安下TAB能跳到 EDIT3吗?
    EDIT3。TABORDER:=2 procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
    begin
     if (Key=#13) and (ActiveControl.Tag<>100) then //同时将KeyPreview属性设为True
      begin
      Key:=#0;
      Perform(WM_NEXTDLGCTL,2,0);
      end;
    end;
      

  4.   

    你设置TABORDER:=2  就好了,,当然ENABLED=FALSE是没效的
      

  5.   

    把Form的KeyPreview设为True
    根据控件的taborder顺序跳,在Form的KeyDown事件写上:if Key=13 then
    SelectNext(ActiveControl,True,True);
      

  6.   

    Edit1:  TABORDER:=0
        Edit2: TABORDER:=1
        Edit3: TABORDER:=2
    安你的做法,
    procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
    begin
     if (Key=#13) and (ActiveControl.Tag<>100) then //同时将KeyPreview属性设为True
      begin
      Key:=#0;
      Perform(WM_NEXTDLGCTL,2,0);
      end;
    end
    好像在EDIT1安下TAB还是不能跳到EDIT3啊
      

  7.   

    EDIT3不能设置成1,还有别的方法吗?
      

  8.   

    case5166
    (我看见佛) ,你的方法,只适合用回车,用TAB不行,有没有别的方法啊??
      

  9.   

    怎么看能呢?默认就是支持TAB键的,,
      

  10.   

    这的问题是 当按下TAB时,焦点要在指定的控件上。不是按照TABORDER的排列
      

  11.   

    你指定是什么意思?你可能通过TABORDER的顺次来指定啊,,晕了
      

  12.   

    就是说,我现在有很多控件,当我在EDIT1安下TAB时要跳到Edit_Str,因为还有好多的控件,所以Edit_StrR的TABORDER不在EDIT1的下一个。还差好远,如果改TABORDER的话会有很多的控件要改,所以只要在EDIT1下安TAB能跳到Edit_Str就行了,这个怎么做啊????
      

  13.   

    那你只需要Edit_StrR.TABORDER := EDIT1的TABORDER+1就好了,也是只设置一个
      

  14.   

    当这样设置时跟本就没用啊因为edit1是在PANEL里的,Edit_StrR是在另一个PANELEDIT1的TABORDER+1的控件就变了,它也得不到焦点照你说的做,用代码写好像没有用,在我问问题之前我就已经试过了能不能用别的方法啊??
    高手帮帮啊