On 11/12/11 6:19 AM, Saeed H. Al Turki wrote: > Yes, this works fine. However, I noticed something strange. > > In the attached example, there are 9 squares. Leaving and entering the > squares on the outside border trigger both (EVT_FC_ENTER_OBJECT and > EVT_FC_LEAVE_OBJECT) events fine. However, if the mouse is on one of > the squares in the middle, it triggers EVT_FC_LEAVE_OBJECT but > not EVT_FC_ENTER_OBJECT. Am I missing something in my code ?
nope -- it's a bug in FloatCanvas -- it looks like if the mouse passed from one object to another, without hitting empty space first, then the second object's Enter event doesn't get processed. I'll dig into that now, but If I don't have a fix before you read this, the problem is most likely in the (quite ugly!) MouseOverTest() method in the FloatCanvas class. NOTE: I noticed another issue. If the mouse leaves the Window directly from an object, the leave event doesn't get processed -- I'm not sure if it should or not -- it does get processed when the mouse re-enters the Window outside of that object. -Chris > Cheers, > Saeed > > > On 7 November 2011 21:43, Chris.Barker <[email protected] > <mailto:[email protected]>> wrote: > > On 11/6/11 5:54 PM, Saeed H. Al Turki wrote: > > I created a polygon shape using Canvas.AddPolygon as the > following: > > > > > > H = Canvas.AddPolygon(polygon_points, LineColor = '#1A1A1A', > FillColor = > > '#EEEE99') > > > > When I move the mouse over the 'H' shape, I trigger a > function called > > 'colorFlash': > > > > H.Bind(FloatCanvas.EVT_FC_ENTER_OBJECT, self.colorFlash) > > > > My question: what is the best way to change the color of 'H' > inside the > > 'colorFlash' function? The end goal is to have a flashing > effect when > > mouse hover over the polygon shape in order to make it more > obvious to > > the end user. > > Try: > > def self.colorFlash(self, obj): > obj.SetFillColor(A_new_color) > self.Canvas.DrawDraw(self, Force=True) > > Then you can bind to EVT_FC_LEAVE_OBJECT to change it back. > > If your drawing is complex, this may be kind of slow -- if so, > put a new > object on top in th foreground, instead of changing the color. > > If that doesn't work, post a small self-contained example, and we'll > figure it out. > > -Chris > > > > > > Thanks. > > > > > > > > > > _______________________________________________ > > FloatCanvas mailing list > > [email protected] <mailto:[email protected]> > > http://paulmcnett.com/cgi-bin/mailman/listinfo/floatcanvas > > > -- > Christopher Barker, Ph.D. > Oceanographer > > Emergency Response Division > NOAA/NOS/OR&R (206) 526-6959 <tel:%28206%29%20526-6959> voice > 7600 Sand Point Way NE (206) 526-6329 <tel:%28206%29%20526-6329> > fax > Seattle, WA 98115 (206) 526-6317 <tel:%28206%29%20526-6317> > main reception > > [email protected] <mailto:[email protected]> > _______________________________________________ > FloatCanvas mailing list > [email protected] <mailto:[email protected]> > http://paulmcnett.com/cgi-bin/mailman/listinfo/floatcanvas > > > > > > _______________________________________________ > FloatCanvas mailing list > [email protected] > http://paulmcnett.com/cgi-bin/mailman/listinfo/floatcanvas -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [email protected] _______________________________________________ FloatCanvas mailing list [email protected] http://paulmcnett.com/cgi-bin/mailman/listinfo/floatcanvas
