Update a pad in process of expernal lib call

Hello,

What is the right way to update TGraph object?
I have an external libraray call from ROOT. The code looks like

THandler : public TLibEventHandler {
public:
int m_np;
TGraph *m_g;
TCanvas *m_c;

void OnEvent(int somedata) {
m_gr->SetPoint(m_np, m_np, somedata);
m_np++;
m_c->Update();
}

}

TLibObject *o = new TLibObject();
THandler *h = new THandler();
o->SetHandler(h);

h->m_c = new TCanvas(“c1”,“A Simple Graph”,200,10,700,500);
h->m_g = new TGraph(1);
h->m_g->Draw(“L”);

o->Process(); //infinite loop inside

If Process call never ends du to infinite loop inside, the graph is not updated. Actually the graph is feezed.
So, is there any other then Update() way to update TGraph object?

Thanks in advance!

Regards,
Ilya

Partialy solved by adding TGraph->Draw() method call. The graph is updating now, but the pad inside the canvas still doesn’t respond on resize by mouse.

Hi,

The call tom_c->Update();is only effective is the canvas knows or notice that it has been modified. To for the update you can usem_c->Modified(); m_c->Update();

Cheers,
Philippe.