delphi中判断popupmenu的弹出来源....

正在用delphi xe编写一个小程序。。。

界面上有十几个label,想通过右键点击弹出popupmenu,修改label的颜色

因此,需要判断popupmenu的来源...

上网搜索了半天,发现了解决办法:

定义:

pm1:Tpopupmenu;

判断:

showmessage(pm1.PopUpComponent.name);