TH2 Click() event

Just wondering if anyone knew how to register the bin (x,y) of a click in a 2d histogram, or even if it is at all possible.

Essentially what I need to do is draw a line (or at least get the start and end point of the line) inside a filled 2d histogram.

Any help would be greatly appreciated.

p.s. I looked through alot of documentation and I know there are click() events for buttons, just could not find anything for histograms, much less on reporting the location of the click.

see tutorial exec3.C (also below)


[code]void exec3()
// Example of using signal/slot in TCanvas/TPad to get feedback
// about processed events. Note that slots can be either functions
// or class methods. Compare this with tutorials exec1.C and exec2.C.

TH1F h = new TH1F(“h”,“h”,100,-3,3);
TCanvas c1=new TCanvas(“c1”);
)", 0, “”,

void exec3event(Int_t event, Int_t x, Int_t y, TObject *selected)
TCanvas *c = (TCanvas *) gTQSender;
printf(“Canvas %s: event=%d, x=%d, y=%d, selected=%s\n”, c->GetName(),
event, x, y, selected->IsA()->GetName());