想编写一个过程EnabledControl.调用时:
EnabledControl(MyButton,true);  <--这样会把MyButton这个TButton的Enabled设为true.EnabledControl(MyMenu,false);   <--这样会把MyMenu这个TMenuItem的Enabled设为false.EnabledControl(MyToolButton,true); <--这样会把MyToolButton这个TToolButton的Enabled设为true编写这过程不允许有if 和case等条件判断语句.

解决方案 »

  1.   

    还要补充一下,也不能使用overload关键字.
      

  2.   

    procedure TForm1.EnabledControl(Sender: TObject;Flag : boolean);
    begin
      (Sender as TControl).Enabled := Flag;
    end;procedure TForm1.Button1Click(Sender: TObject);
    begin
      EnabledControl(Button1,False);
    end;
      

  3.   

    procedure TForm1.Edit1Click(Sender: TObject);
    begin
      EnabledControl(Edit1,False);
    end;