Hi Brett, TPad::Pick loops on all the objects inside the pad, computing the DistancetoPrimitive for each object and selecting the one with the smallest distance if this distance is less than kMaximumDistance = 5 pixels. If kMaximumDistance is set to a smaller value, picking indeed becomes more precise but also more difficult. For example with kMaximumDistance set to 1, it becomes nearly impossible to pick an object. I have introduced some mods in both TPad and TBox (only in CVS source). In TPad, I have replaced the constant kMaximumDistance by a static member fgMaxPickDistance + SetMaxPickDistance and GetMaxPickDistance. You can play with SetMaxPickDistance to figure out yourself how difficult it is to pick if you set a small value. I have modified TBox::DistancetoPrimitive such that; - if the box is filled, the box is picked only when the mouse is inside the box. - if the box is not filled, the box is selected as soon as the mouse is within fgMaxPickDistance pixels of the box outline. Rene Brun Brett Viren wrote: > > Hi, > > It seems that when a pointer approaches a TObject in a TPad it gets > events (via ExecuteEvent) before the pointer actually reaches the > TObject. It gets a kMouseEnter (52) when the pointer is about 4 > pixels away. Furthermore, this event is accompanied by a pixel > location of 0,0 (why??). > > This makes it difficult to write accurate ExecuteEvent() methods. Is > there some way I can know when the pointer has really entered the > object with outh keeping a bunch of pointer state information in my > TObjects? > > I guess I can see the need for some kind of "proximity" event, but > this should be its own event (ie, kProximityEnter, kProximityLeave) > and kMouseEnter/kMouseLeave should only get delivered when the pointer > actually enters/leaves the object. > > Any chance to fix this, or is there some design reason for it that I > am missing? > > Thanks, > -Brett.
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:12 MET