有没有PB的那种,点哪个控件就是this.name这类的写法?

解决方案 »

  1.   

    不知你要干吗,delphi中用,控件点击事件中的参数sender就是他本身
      

  2.   

    写不出来,你写一个我看一下?
    在radionbutton的click里写的
    t :=TcxRadioButton(Sender).Caption;
    这样我这取到的怎么成了窗体的caption
      

  3.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, Menus, cxLookAndFeelPainters, StdCtrls, cxButtons, cxRadioGroup;type
      TForm1 = class(TForm)
        cxRadioButton1: TcxRadioButton;
        procedure cxRadioButton1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.cxRadioButton1Click(Sender: TObject);
    var
      s:string;
    begin
      s:=(TcxRadioButton(Sender).Caption);
      ShowMessage(s);
      //s等於cxRadioButton1;
    end;end.
      

  4.   

    開始以為你要類別pb的那種this.name的寫法如果是組件本身,可以用sender對象定義...unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, Menus, cxLookAndFeelPainters, StdCtrls, cxButtons, cxRadioGroup;type
      TForm1 = class(TForm)
        cxRadioButton1: TcxRadioButton;
        procedure cxRadioButton1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.cxRadioButton1Click(Sender: TObject);
    var
      s:string;
    begin
      s:=(TcxRadioButton(Sender).Caption);
      ShowMessage(s);
      //s等於cxRadioButton1;
    end;end.