> Concerning above question, I made the following code to see how to
> get x and y, but it does not work. The reason seems that I can not
> find the object of my class in TCanvas. Could you give me a little
> more guidance ?
  The current TPad regards the distances those less then 5 pixel.
  So if your 
Int_t test::DistancetoPrimitive(Int_t px, Int_t py)
{
   return TH1::DistancetoPrimitive(px, py);
}
  returns the number > 5, TPad assumes your TObject is too far from 
the mouse pointer to be selected.
  Please check what that method does return for your case.
                Valery
=================================================================
Dr. Valeri Faine (Fine)
    -------------------          Phone: +1 516 344 7806
Brookhaven National Laboratory   FAX  : +1 516 344 4206
Bldg. 510A /STAR                 mailto:fine@bnl.gov
Upton, New York, 11973-5000      http://nicewww.cern.ch/~fine
USA
                                 
Dr. Valery Fine                  Telex : 911621 dubna su
    -----------
LCTA/Joint Inst.for Nuclear Res. Phone : +7 09621 6 40 80
141980 Dubna, Moscow region      Fax   : +7 09621 6 51 45
Russia                           mailto:fine@main1.jinr.dubna.su