Pon dos TLabels en tu form (Label1 y Label2). Pon un TPopupMenu, asociandolo a la form. Pon este código en el evento OnPopUp del PopUpMenu
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 son 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;
Ważne artykuły