Take coordinates with the mouse (solved)


I’m trying to draw points on a TCanvas with the mouse. The problem is that it seems impossible to take points on a frame… How should i do ? When the cursor is over the frame, nothing happens, i can’t see the status of the mouse…

Here is the concerned part of my program :

class Fenetre: public TCanvas
    public:Fenetre::Fenetre(Text_t* name, Text_t* title, Int_t posx,Int_t posy, Int_t ww, Int_t wh):TCanvas(name,title,posx,posy,ww,wh)
	{ } 
//---- Function which is called if the mouse is moving ------
	void Fenetre::ExecuteEvent(Int_t event, Int_t px, Int_t py)
 //-- show mouse status --------
		cout<<" position: px="<<px<<" py="<<py<<" code du bouton="<<event<<endl;
//-- convert pixel position into coordinates ------
		double x,y;
//-- show coordinates of the selected point ---
			cout<<"x="<<x<<", y="<<y<<endl;

/********             fonction principale               ********/

int main(int argc, char** argv)	{
    TApplication theApp("App",&argc,argv);
    TCanvas *c1=new Fenetre ("c1","Modélisation...",0,0,600,400);
    int n=2;
    double x1=-n,x2=n,y1=-n,y2=n;
    return 0;


That’s ok now. I use Range instead of DrawFrame and not only it works, but my program is a lot faster…