Re: BuildLegend and gPad

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Thu, 8 Dec 2011 08:19:09 -0600


Hi Andrea,

In v5.32, we updated the technique used to expose gPad to CINT. The great advantage is that it is now exposed even when it is still set to zero. Another consequence is that rather than its type being the type of the object it points to, it is now of created (in CINT) with it's real type (TVirtualPad). In particular this means that gPad->BuildLegend was already rejected by the compiler (i.e. CINT behave closer to the compiler's behavior in this case).

Cheers,
Philippe.

On 12/8/11 8:09 AM, Andrea Massironi wrote:
> 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:19:15 CET

This archive was generated by hypermail 2.2.0 : Fri Dec 09 2011 - 17:50:01 CET