How to grab the ProcessedEvent(Event_t*) from a TCanvas

Hi,

I am trying to grap the Event_t* from a TCanvas. I know ho to do it from a TRootEmbededCanvas, using the Container signal, but is it possible to do this from a standard TCanvas ?

The ProcessedEvent(Event_t*) from the container contains much more information that the one accessible from the ProcessedEvent(Int_t, Int_t, Int_t, TObject*) method of TCanvas

Thanks for your help

Jérémie

Hi Jérémie, here is an example:

   ((TRootCanvas *)c1->GetCanvasImp())->Connect("ProcessedEvent(Event_t*)", 0, 0, "EventProcessed(Event_t*)");

Cheers, Bertrand

Hi Bellenot,

Thanks for your help. Actually I have already tried to do like this, but I don’t get any signal from this connexion. For example, using the simple following macro, I never obtain any printouts of the EventProcessed function:

void EventProcessed(Event_t *event)
{
    char input[10];
    UInt_t keysym;

    gVirtualX->LookupString(event, input, sizeof(input), keysym);

    // look in KeySymbol.h
    std::cout << "ProcessedKeyEvent : " << event->fCode << " " << event->fState <<" ; "<< event->fType  << "; " << keysym << std::endl;
}

void test()
{
    
    TCanvas *c = new TCanvas;
    ((TRootCanvas *)c->GetCanvasImp())->Connect("ProcessedEvent(Event_t*)", 0, 0, "EventProcessed(Event_t*)");

}

Do I made something wrong ?

Jérémie

You’re right, in fact I’m afraid there is no way to get the events other than the ones available with TCanvas::ProcessedEvents(Int_t, Int_t, Int_t, TObject*)

Actually I have found how to do it ! this command works for me:

    ((TRootCanvas *)c->GetCanvasImp())->GetClient()->Connect("ProcessedEvent(Event_t *, Window_t)", 0,0, "EventProcessed(Event_t*)");

Right, but then you get the events for all windows & sub-windows…

Indeed… but at least it is doing what I need.

1 Like

BTW, I think you can use gClient instead of ((TRootCanvas *)c->GetCanvasImp())->GetClient()

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.