unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
PopupMenu1: TPopupMenu;
a1: TMenuItem;
procedure a1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.a1Click(Sender: TObject);
begin
if (sender as TButton).tag=1 then
showmessage('1');
if (sender as TButton).tag=2 then
showmessage('2');
end;
end.
为什么会编译不过??
ShowMessage((PopupMenu1.PopupComponent).Name);
这个通过判断name我学会了,等我学会了tag再分配分数.
虽然分少,但希望知道的教教我.