I’m trying to overload the TGraphErrors::RemovePoint
function by creating a class that inherits from TGraphErrors
. The overloaded RemovePoint
function uses the same code as the original one to get the position of the mouse (gPad->GetEventX()
and gPad->GetEventY()
), but for some reason it doesn’t always return the correct position.
I tried replicating it with a simple example, but there it always works (when assuming the returned position to be in absolute pixels), see the attached code.
Unfortunately the code with the problem is too complex to post here, but in that case when clicking on a point at (274., 346.), the resulting x,y are either 108.608, -81.429 (from absolute pixels) or 487.503, -81.429 (from pixels). I double checked that the result of gPad->GetName()
indicates that the right pad is being used, and that I use the right parent for all constructors (as that was causing a similar issue at one point with the example).
Does anyone have an idea what I might be doing wrong or what else I could check? Is there anything I could print out to better understand why gPad->AbsPixeltoX(gPad->GetEventX())
returns the wrong x-position for me?
Test.C (5.5 KB)