What is the component a popup menu click originated from

Did you mean PopupMenu1.PopupComponent ?


You can get the caller component within the click event of the TMenuItem of a PopupMenu by

Caller := ((Sender as TMenuItem).GetParentMenu as TPopupMenu).PopupComponent;

An Example of a PopupMenu which is assigned to several list boxes and solves the export to file functionality:

procedure TForm1.mniExportFileClick(Sender: TObject);
var Caller: TObject;
begin  
  if SaveTextFileDialog1.Execute then
  begin
    Caller := ((Sender as TMenuItem).GetParentMenu as TPopupMenu).PopupComponent;
    (Caller as TListBox).Items.
      SaveToFile(SaveTextFileDialog1.FileName,
        StandardEncodingFromName(
          SaveTextFileDialog1.Encodings[SaveTextFileDialog1.EncodingIndex]));
  end;
end;