Re: class TControlBar
Rene Brun (Rene.Brun@cern.ch)
Tue, 17 Feb 1998 13:27:03 +0100
Krieg, M. wrote:
>
> Hi,
> I am writing a scientific programm and would like to use the ROOT facilities
> both for the user interface and to display and print the graphs of input
> and output data on the screen. Concerning the user interface I have the
> following question about the controlbar: it seems to me (as far as I
> understood your responses in the mailing list) that it is possible to attach
> pure C++ code to a controlbar button instead of a CINT-makro. What I want to
> do is to attach a function of my own class TSolution to the button, to get a
> graph of my solution when the button is pressed.
>
> Here is a piece of code of the main program:
> main(..){
>
> TSolution mySolution;
> TControlBar *bar= new TControlbar("vertical");
>
> bar->AddButton("ShowSolution","mySolution.Display()","a graph of the current
> solution is shown");
>
> }
>
> Trying that, I always get the error message "No symbol mySolution.Display
> in current scope" which appears clear to me, because mySolution is not known
> in the scope of TControlBar.
> Nevertheless, is there a way to use the controlbar as a user interface mixed
> with own code like I was trying it?
>
> Any help would be appreciated A LOT!
>
> Martina
A small example
{
// example of a TControlBar calling member functions
gROOT->Reset("a");
bar = new TControlBar("vertical");
TF1 *f1 = new TF1("f1","sin(x)/x",0,10);
bar->AddButton("f1(1)","f1->Eval(1)", "Evalute f1 at x = 1 ");
bar->AddButton("Integral","f1->Integral(0,2)", "Integral of f1
between 0 and 2");
bar->AddButton("Print","f1->Print()", "Print f1 object");
bar->Show();
gROOT->SaveContext();
}
Rene Brun