Hi,
I'm trying to build a trivial GUI so that when I click on different
buttons, different plots are generated. My first go is to have a button
that plots the example sin(x)/x.
>From some code posted earlier on roottalk:
I have a button defined (b) that acts as a quit button:
TGButton *b = new TGTextButton(&mf, "Quit");
b->SetCommand("gApplication->Terminate()");
which works fine.
but if I change this to run my PlotGraph function:
b->SetCommand("PlotGraph()");
where PlotGraph is:
void PlotGraph(void){
TCanvas *c1 = c->GetCanvas();
TF1 f1("func1", "sin(x)/x", 0, 10);
f1.Draw();
c1->Update();
}
*c is defined before main{} as
TRootEmbeddedCanvas *c = new TRootEmbeddedCanvas("Canvas", &mf, 600, 400);
which I believed made c global (therefore accessable from any other
function)...
When I compile the code and run it, I get:
[] ~/root $ ./canvasgui
Error: Function PlotGraph() is not defined in current scope
FILE:/tmp/filezX8DtE_cint LINE:1
Which has me (a c++ newbie) stumped. Presumably I've missed out some
important step...
Thanks in advance,
Paul
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:49 MET