To read an entry from a TLegend

I have the following script with a comment to understand my problem. Is there a possible way to do this. I used just one of the tutorials as testing basic script.

/Christian
test.C (1.12 KB)

Your code is:

   leg1->AddEntry(gr,"Test");
   leg1->Draw();
                                                                                                                
   leg2 = new TLegend(0.5,0.5,0.85,0.65);
   leg2->SetFillColor(10);
   leg2->SetBorderSize(1);
// NOW I WANT TO READ THE ENTRY(WITH CORRESPONDING TEXT ATTRIBUTES)
// FROM leg1 AND USE IT AS THE ENTRY IN THIS LEGEND
   leg2->Draw();

Why don’t you do leg2->AddEntry(gr,“Test”); … I am not sure to understand exactly what you want.