procedure TForm1.PopupMenu1Popup(Sender: TObject);
var
Cur : TPoint;
begin
{Al parecer sólo para componentes que puedan recibir el foco}
{Obtiene la posición del ratón}
GetCursorPos(Cur);
{Obtenemos el nombre del control}
label2.caption:=FindControl(windowfrompoint( Cur )).Name;
{Si són tedit o tdbedit muestra el contenido de la edición}
if FindControl(windowfrompoint( Cur )).ClassType =TEdit then
label1.caption:=TEdit(FindControl(windowfrompoint( Cur ))).Text;
if FindControl(windowfrompoint( Cur )).ClassType =TDBEdit then
label1.caption:=TDBEdit(FindControl(windowfrompoint( Cur ))).Field.AsString;
end;
|