// test.C TGraph *tg=0; void scan(bool rescan) { if(rescan) { tg->Set(10); // mimicing what my much larger macro does tg->SetPoint(0,0.0,1.0); tg->SetPoint(1,1.0,1.0); tg->SetPoint(2,1.0,0.0); tg->SetPoint(3,-1.0,1.0); tg->SetPoint(4,0.0,-1.0); tg->Set(5); // mimicing what my much larger macro does tg->Draw("ALP"); } else { tg->Set(10); // mimicing what my much larger macro does tg->SetPoint(0,0.0,1.0); tg->SetPoint(1,1.0,2.0); tg->SetPoint(2,2.0,3.0); tg->SetPoint(3,3.0,4.0); tg->SetPoint(4,4.0,5.0); tg->Set(5); // mimicing what my much larger macro does } } void test() { gEnv->SetValue("Canvas.ShowEditor",1); tg = new TGraph(2); // 2 is # points (changed in scan()) scan(false); tg->Draw("ALP"); c1->Selected(c1,c1->FindObject(tg),1); }