Mouse Enter, Leave and Motion events

Hi,

I’m confused about those events. It seems the global pad (gPad) is not the same for MouseMotion (where it looks like the “top” pad) and in the other two. Is that the case ?

Regards,

Hi,

I suppose you are talking about TCanvas::HandleInput?
It is simple : Pick(px, py, prevSelObj); returns the pad over which the mouse is, then EnterLeave() make the previously selected pad/object handling the mouse leave event and the newly selected pad/object handling the mouse enter event (as the mouse leaves an object to enter another one…)
If it is not what you wanted to understand, please let me know, or precise your question (maybe by pointing a concrete piece of code)

Cheers,
Bertrand.

Hi,

Thanks for the answer. It’s not exactly my problem though.

Trying to get a short sample code is not that simple, so let me try to explain myself better :wink:

I have a T(RootEmbedded)Canvas, with some subpads, in which I draw a given number of objects. Let’s say two objects, simple squares. Both object have the relevant DistanceToPrimitive, etc… methods. Using slots, I forward the ProcessedEvent signal of the canvas to one of my manager classes, which is supposed to handle the MouseEnter, MouseLeave and MouseMotion events. For MouseEnter and MouseLeave events, I find that the “gPad” is the one I expect, i.e. the subpad in which my object is drawn. But for MouseMotion, it seems that the gPad is the canvas itself.
Maybe that’s all normal but I found it confusing at first.

Hope it clearer now,

Regards,

OK, I understand better now. But still, this behavior is normal (even if it is a bit confusing), since the mouse move event is handled by the canvas itself, and gPad change only if you click in a pad (aka pad->cd()) .
If you want to retrieve on which pad the mouse is over, you can try to use i.e. gPad->GetSelectedPad()
Cheers,
Bertrand.