Re: [ROOT] how to handle mouse events in root

From: Martin Schulte-Wissermann (schulte@pktw09.phy.tu-dresden.de)
Date: Wed Jul 31 2002 - 15:02:11 MEST


this is how i do it:{
	c1 = new TCanvas("c1","ein schoenes canvas",200,10,700,450);

 	h = new TH1F("h","htest",100,0,10);
	h->Fill(2,4);h->Fill(6,2);h->Fill(8,7);
	h->Draw();

	// this is leos trick to get the x-position, and to wait for a click
   	TMarker *mark = (TMarker*)gPad->WaitPrimitive("TMarker","Marker");
   	cout<<" position='"<< mark->GetX()<<"'"<<endl;
}

greetings,
 msw


On 30 Jul 2002, Fons Rademakers wrote:

> Sorry forgot to paste the link:
>
> http://root.cern.ch/root/roottalk/roottalk02/2914.html
>
> Cheers, Fons.
>
>
>
>
> On Tue, 2002-07-30 at 23:13, Jo Schambach wrote:
> > I am sorry, Fons, I am a little confused: which message and which thread are
> > you talking about?
> >
> > Cheers,		Jo
> >
> > Fons Rademakers wrote:
> > >
> > > Hi Jo,
> > >
> > >   see this message and the associated thread.
> > >
> > > Cheers, Fons.
> > >
> > > On Tue, 2002-07-30 at 21:31, Jo Schambach wrote:
> > > > Forgive me if this question is a FAQ or has been answered before:
> > > >
> > > > How does one handle mouse events in a custom root application?
> > > > Specifically, here is what I would like to do:
> > > > I have a canvas with 2 pads, one pad containing a 2d histo, the other a 1d
> > > > histo. When the user left clicks (or shift clicks, if left click is already
> > > > used) on the 2d histo, I would like to display the projection of the 2d histo
> > > > at the mouse location in the 1d histo. So I need a way of getting notified
> > > > about the fact and the location of the "left-mouse-click".
> > > > Thanks for any help in advance.
> > > >
> > > > Regards,
> > > >
> > > > Jo
> > > > --
> > > > *******************************************************
> > > > Dr Joachim Schambach
> > > > Physics Department, RLM 5.208 -C1600
> > > > University of Texas
> > > > Austin, TX 78712, USA
> > > > Phone: (512) 471-1303; FAX: (781) 998-5513
> > > > e-mail: jschamba@physics.utexas.edu
> > > --
> > > Org:    CERN, European Laboratory for Particle Physics.
> > > Mail:   1211 Geneve 23, Switzerland
> > > E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
> > > WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7679480
> >
> > --
> > *******************************************************
> > Dr Joachim Schambach
> > Physics Department, RLM 5.208 -C1600
> > University of Texas
> > Austin, TX 78712, USA
> > Phone: (512) 471-1303; FAX: (781) 998-5513
> > e-mail: jschamba@physics.utexas.edu
> --
> Org:    CERN, European Laboratory for Particle Physics.
> Mail:   1211 Geneve 23, Switzerland
> E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
> WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7679480
>
>



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