Re: BuildLegend and gPad

From: Andrea Massironi <Andrea.Massironi_at_cern.ch>
Date: Thu, 8 Dec 2011 15:16:19 +0100


Thank you very much!

     Andrea

On 12/08/2011 03:10 PM, Olivier Couet wrote:
> GPad was converted from TPad to TVirtual some times ago.
> And BuildLegend is only in TPad.
> I am now putting it in TVirtualPad too.
>
> -----Original Message-----
> From: Andrea Massironi
> Sent: Thursday, December 08, 2011 3:10 PM
> To: pcanal_at_fnal.gov
> Cc: Axel Naumann; Olivier Couet; roottalk (Mailing list discussing all aspects of the ROOT system.)
> Subject: Re: [ROOT] BuildLegend and gPad
>
> Thank you to everybody!
>
> My only remaining curiosity is why in the previous releases it worked.
>
> In the previous ROOT release*, gPad (the class TVirtualPad) had the method BuildLegend (for example using tab completion of "gPad->" I could see "BuildLegend", while now it doesn't).
>
> Thanks,
> Andrea
>
>
> * I tried with tags/v5-30-00_at_40062
>
>
>
> On 12/08/2011 02:34 PM, Philippe Canal wrote:
>> Hi,
>>
>> The problem is not really about CINT.
>> It strictly due to the fact that TVirtualPad (the type pointed to by
>> gPad)
>> does *not* have a BuildLegend member function.
>>
>> Cheers,
>> Philippe.
>>
>>
>>
>> On 12/8/11 4:45 AM, Axel Naumann wrote:
>>> Hi Olivier,
>>>
>>> How's that CINT-related? I don't see any TVirtualPad::BuildLegend().
>>> Should it be added?
>>>
>>> Cheers, Axel.
>>>
>>>
>>> Olivier Couet wrote on 12/07/2011 09:55 AM:
>>>> I see the same behavior on my Mac.
>>>> Seems to me it is CINT related as the message tells that BuildLegend
>>>> cannot be called.
>>>>
>>>> I would also recommend you create your histograms with "new" as you
>>>> are using "->"
>>>> to access the Draw(0 method:
>>>>
>>>> void buildlegend()
>>>> {
>>>> TH1F *h1 = new TH1F("h1","h1",100,-2,2);
>>>> TH1F *h2 = new TH1F("h2","h2",100,-2,2);
>>>>
>>>> h1->FillRandom("gaus",10000);
>>>> h2->FillRandom("gaus",10000);
>>>>
>>>> h1->SetLineColor(kRed);
>>>> h2->SetLineColor(kBlue);
>>>>
>>>> TCanvas* cc = new TCanvas ("cc","cc",400,400);
>>>> h1->Draw();
>>>> h2->Draw("same");
>>>>
>>>> TLegend* leg = cc->BuildLegend();
>>>> leg->SetFillColor(kWhite);
>>>> cc->SetGrid();
>>>> }
Received on Thu Dec 08 2011 - 15:16:08 CET

This archive was generated by hypermail 2.2.0 : Thu Dec 08 2011 - 17:50:01 CET