Re: [ROOT] Confused about ExecuteEvent behavior

From: Brett Viren (bv@bnl.gov)
Date: Sun Dec 16 2001 - 18:47:28 MET


More confusion:

Why does typing into a TPad trigger DistancetoPrimitive() calls
(apparently with the ASCII of the key pressed passed in as the pixel's
px,py)?

BTW, appended is some test code which dumps this info to screen as you
move the mouse around.  

Also I forgot to mention, this is with ROOT 3.02/03 (from CVS ~1 month
ago).

-Brett.

///////////////////////
// box.C
// do:
// root> .L box.C++
// root> MyTBox mybox
// root> mybox.Draw();
///////////////////////
#include "TBox.h"
#include <iostream>
class MyTBox : public TBox {
public:
    MyTBox() : TBox(0.2,0.2,0.4,0.4) { SetFillColor(3); }
    ~MyTBox() {}
    virtual int DistancetoPrimitive(int px, int py) {
        int d = this->TBox::DistancetoPrimitive(px,py);
        cerr << "MyTBox distance (" << px << "," << py << ") = " << d
<< endl;
        return d;
    }
    virtual void ExecuteEvent(int event, int px, int py) {
        int dist = this->TBox::DistancetoPrimitive(px,py);
        cerr << "MyTBox got event #" << event 
             << " at [" << px << "," << py << "], d="
             << dist << endl;
    }
};



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:12 MET