You should be more explicit. Demonstrate your ask with an example. So many answer are possible.
But maybe next demo could help.
Start an new project.
On your Form place a Memo, RichEdit, ListBox and a PopupMenu.
Set the property PopupMenu of Memo, RichEdit and ListBox to PopupMenu1.
Open the menu designer of PopupMenu1.
Set the caption property of PopupItem1 to “Clear”
Double click the onClick-event of PopupItem1.
Place next code:
void __fastcall TForm1::Clear1Click(TObject *Sender)
{
TRichEdit *ri;
TMemo *me;
TListBox *li;
if ((ri = dynamic_cast<TRichEdit *> (PopupMenu1->PopupComponent)) != 0)
ri->Lines->Clear();
if ((me = dynamic_cast<TMemo *> (PopupMenu1->PopupComponent)) != 0)
me->Lines->Clear();
if ((li = dynamic_cast<TListBox *> (PopupMenu1->PopupComponent)) != 0)
li->Items->Clear();
}