ferhue
March 11, 2016, 10:03am
3
This is a duplicate of:
I am a novice programmer, and after a few hours of trying to understand the examples and documentation, I am stuck. What I want to do is access a particular entry of my legend so I can adjust its text size. I can do using leg as my legend name:
TLegendEntry ent = (TLegendEntry)leg->GetListOfPrimitives()->First(); and get the first entry fine although I don’t fully understand the above line.
However, say I have a legend of 10 entries and want to access the third. I don’t understand the class TI…
Example:
// TLegend* l was already defined and drawn
if(l==NULL) return;
TIter next(l->GetListOfPrimitives());
TLegendEntry* le;
UInt_t n = 1;
while((le=(TLegendEntry*)next()))
{
le->SetOption("l");
n++;
}
Alternatively:
TLegendEntry *tle = (TLegendEntry *)listA->At(2);