No kMouseLeave events?

Hi,

Putting custom objects in a TRootEmbeddedCanvas, I do not seem to be able to get kMouseLeave events, while I do get kMouseEnter ones. Is there something special to implement in my objects (besides what I currently have, i.e. DistanceToPrimitive and ExecuteEvent) to solve this ?

Thanks,

root 5.16/00 on macos intel

Hi,

The following information might help. Please see the tutorials example $ROOTSYS/tutorials/exec3.C. In a similar way you can do:TCanvas *myc = fEcan->GetCanvas(); myc->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)","MyMainFrame",this, "EventInfo(Int_t,Int_t,Int_t,TObject*)"); where fEcan is TRootEmbeddedCanvas pointer; ProcessedEvent is a signal method of TCanvas, MyMainFrame is the name of a user class, containing the slot method EventInfo. If EventInfo contain the following lines[code]void MyMainFrame::EventInfo(Int_t event, Int_t px, Int_t py, TObject *selected)
{

if (event == kMouseLeave)
printf(“kMouseLeave happens\n”);

}
[/code]you should see the printout message anytime the mouse cursor leaves the TCanvas area.

Cheers, Ilka

I forgot about another tutorials we have: $ROOTSYS/tutorials/gui/statusBar.C

Cheers, Ilka

Yes, this indeed works. But I find strange that the object itself is not informed that it looses focus, i.e. the object itself does not get the kMouseLeave event, while it gets the kMouseEnter.
Is there a special reason for this “asymmetry” ?

Regards,

Hi,

In addition, you may use in your code something as:if (gPad->GetEvent() == kMouseLeave) // do what is needed Cheers, Ilka

you mean that in MyClass::ExecuteEvent I should add :

if ( gPad->GetEvent() == kMouseLeave ) { ... }

after the normal sequence of

switch (event) { case kButton1Down: .... break; }

??

Hi,

No 100% sure without an example from your side; just an idea. May be you can include the case kMouseLeave in your switch(event) statement. I hope some of our ExecuteEvent experts will anser further your questions.

Cheers, Ilka