Re: [ROOT] mouse button

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Jul 18 2002 - 23:38:41 MEST


Hi Ed,

Run the following small script and you will see that pressing left key
generates event=1. In Root, do .x event3.C

Rene Brun

//------file exec3.C
void exec3() {
   TH1F *h = new TH1F("h","h",100,-3,3);
   h->FillRandom("gaus",1000);
   TCanvas *c1=new TCanvas("c1");
   h->Draw();
   c1->Update();
   c1->AddExec("ex","exec3event()");
}
void exec3event()
{
   int event = gPad->GetEvent();
   int px = gPad->GetEventX();
   int py = gPad->GetEventY();
   printf("event=%d, px=%d, py=%d\n",event,px,py);
}



On Thu, 18 Jul 2002, Ed Oltman wrote:

> Hello,
> 
> Is there a way to determine if the mouse is positioned within a canvas and
> the left button is pressed?  TCanvas::GetSelected() returns a pointer to the
> selected TObject, in the canvas, but I would also like to know if the left
> button is pressed.  I cannot sense the button state from within at TExec.  I
> am using Root 3.02/07 on Win32.  Thanks..
> 
> Ed
> 
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:00 MET