Draw line into TGraph

Hello!

I have a very simple need, but I still was not able to solve it.

Starting from a TGraph drawn into a pad, I would like to draw a vertical line at the position of the mouse when the mouse button is clicked. I have added a TExec to the canvas and I am able to get the mouse event and also the mouse position, but when I try to draw a line with gPad->Paintline(,), nothing appears.

Could anybody maybe give me a hint how one should do this?

Thanks,

Jens

See $ROOTSYS/tutorials/graphics/canvas.C
root.cern.ch/root/html/examples/gif/canvas.gif
It shows how to draw the “moving” lines using the TLine class
root.cern.ch/root/html/TLine.html
Try it as follows