Re: [ROOT] TCanvas::cd() on mouse click

From: Valeriy Onuchin (Valeri.Onoutchine@cern.ch)
Date: Mon Nov 10 2003 - 17:15:30 MET


 Hi Alex,
as Rene mentioned it's easy to do with the middle mouse button.
Nevertheless if you prefer left mouse button :-) it's possible ...
after execution the following macro

//////////////////////////////////////////// cd_canvas.C //////////////////////////////////////
#include "TCanvas.h"

void change_canvas(Int_t event,Int_t,Int_t,TObject*)
{
   TVirtualPad *sav = gPad;
   TCanvas *c = (TCanvas*)gTQSender;
   if (event==kButton1Down) c->cd();
   sav->Update();
}

void cd_canvas()
{
   TQObject::Connect("TCanvas","ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
                                   0,0,"change_canvas(Int_t,Int_t,Int_t,TObject*)");
}

Regards. Valeriy


Hello all

Is there any way on ROOT to cd() to a canvas when I click on it with the
mouse. I am asking that because I have two canvas open and I would like
to select which one of them I will draw a histogram by clicking on it.

Thanks

Alex
-------------------------------
Dr. Alexandre Suaide
55-11-3091-7072
Departamento de Física Nuclear
Universidade de São Paulo, Brasil



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:16 MET