Re: pick objects

Valeri Fine (fine@bnl.gov)
Wed, 9 Jun 1999 20:28:35 -0400


>
>
> Dear Rooters,
>
> Is it possible to switch off the ability of the object
> to be picked with mouse? Sometimes it very useful.
>

I think if one added the object of the class below to the current pad as
very first object
it would provide that job. I didn't try myself yet (;-)) so all bugs of
this code are yours :-)

class MyPickLocker : public TObject
{
privet:
Bool_t lockMouse;
TVirtualPad *lockedPad;
public:
MyPickLocker(Bool_t lock=kTRUE) {lockMouse = kTRUE;lockedPad= 0;}
void SetMouseLock(Bool_t lock=kTRUE){ lockMouse = lock;}
void SetPad(TVirtualPad *pad=0){lockedPad= pad;}
void SetMouseUnLock(){ SetMouseLock(kFALSE);}
Bool_t GetMouseLock(){ return lock;}
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py){
TVirtualPad *pad = lockedPad;
if (!pad) pad = gPad;
if (lockMouse && pad) {
pad->SetSelected(0);
return 0;
}
}
} ;

Just an idea, may be Rene will comment this.

Valery