比如焦点在edit1,那就复制过去,edit2,点哪哪里焦点就获得这些caption

解决方案 »

  1.   

    焦点在edit1上按按扭Button1
    edit1.text:=Button1.capion;
      

  2.   

    焦点在edit1上按按扭Button1
    edit1.text:=Button1.capion;
      

  3.   

    如果有edit2呢,我总不能写一堆的代码
      

  4.   

    showmessage(TButton(ActiveControl).caption);
      

  5.   

    你可以写成一个结构如下:
      case 条件 of
         条件1:
           begin
          end;
        条件2:
           begin      end;
       end;
    这样可以相对的减少代码的"冗余"
      

  6.   

    把所有的button的onclick事件共用同一个事件,比如全部关联到button1onClick上
    用Tbutton(Sender).caption取得
      

  7.   


    这个我知道,关键是如何知道哪里获得的焦点,这样修改那个焦点的caption
      

  8.   

    Self.ActiveControl 就是焦点所落在的控件上