edit1 onchange事件中写一个
case Edit1.text do
'1':button1.setfocus;(可能你这里是要调用button1的click事件)
....

解决方案 »

  1.   

    procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
    begin
    if key='1' then button1.SetFocus;
    end;
      

  2.   

    你可以通过设置一组相应控件的TAG属性来实现这一功能。首先在窗体中放置5个BUTTON控件,然后分别设置这三个控件的TAG属性为1、2、3、4、5。接下来在edit1的某个事件里输入如下代码:
    procedure TForm1.*******(Sender:TObject);
    varcap:string;
    begin
    caseTButton(sender).Tagof
    1:button1.enable=true;
    2:button2.enable=true;
    3:button3.enable=true;

    end;
    end;
    这样一来就可以实现你要的功能了。
      

  3.   

    错了,我以为做控件数组呢,wljcr(不要了吧?) 和cygnet2001(小丸子) 说的都对!
      

  4.   

    procedure TForm1.Edit1Change(Sender: TObject);
    begin
    case strtoint(edit1.Text) of
    1:button1.SetFocus;
    2:button2.SetFocus;
    3:button3.SetFocus;
    4:button4.SetFocus;
    5:button5.SetFocus;
    else
    showmessage('hello');
    end;
    end;