#include #include #include #include "TROOT.h" void exec3() { // Temporary work around the lack of automatic refresh of the list // when a script is reloaded. gROOT->GetListOfGlobalFunctions()->Delete(); TH1F *h = new TH1F("h", "h", 100, -3, 3); h->FillRandom("gaus", 1000); TCanvas *c1 = new TCanvas("c1"); h->Draw(); c1->Update(); c1->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)", nullptr, nullptr, "exec3event(Int_t,Int_t,Int_t,TObject*)"); } void exec3event(Int_t event, Int_t x, Int_t y, TObject *selected) { TCanvas *c = (TCanvas *)gTQSender; printf("Canvas %s: event=%d, x=%d, y=%d, selected=%s\n", c->GetName(), event, x, y, selected->IsA()->GetName()); }