Re: TControlBar in a class (fwd)

From: Ilka Antcheva <Ilka.Antcheva_at_cern.ch>
Date: Wed, 17 Aug 2005 11:55:10 +0200


Hi Panos,

Please see the attached macro cbar1.C as an example. You can have a TControlBar as a data member in your class set to 0 in the class constructor and created in the method ShowResults(). Please note, gROOT->Reset() should not be used in a named script or a compiled program.

Best regards, Ilka

> Dear all,
>
> suppose I have a class with two methods (apart from the constructor etc):
>
> void MyClass::PrintEventStats()
> void MyClass::ShowResults()
>
> Inside the Show method I create a TControlBar object with several
> buttons such as "Event stats", "Show analysis cuts" etc. Each of these
> buttons is supposed to call some other method of the same class. Let's
> say that the "Event stats" button should call the PrinEventStats
> method. Inside the class this is implemented as follows:
>
> void MyClass::ShowResults()
> {
> gROOT->Reset();
> TControlBar *menu1 = new TControlBar("vertical","Event Cuts",10,10);
> menu1->AddButton("Event
> statistics","MyClass::PrintEventStats()","Displays the event
> statistics");
> .
> .
> .
> menu1->Show();
>
> gROOT->SaveContext();
> }
>
> It compiles, I load the .so, create a MyClass object but when I press
> the "Event stats" button I get a segmentation violation.
>
> Any ideas on what to put in the action?
>
> Cheers,
> Panos
>
> ps: If I use menu1->AddButton("Event
> statistics","PrintEventStats()","Displays the event statistics") I get
> that the fuction is not defined.
>
>

Received on Wed Aug 17 2005 - 12:04:42 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:11 MET