David Poundall wrote:
> I am using the event wx.EVT_LEFT_DOWN which fires before
> FC.EVT_FC_LEFT_DOWN. The latter is set whenever an object is selected
> on the canvas, but how do | register that the canvas itself has been
> clicked. That is to say, objects have been missed.
You should never need to use wx.EVT_LEFT_DOWN, though if you do, calling
event.Skip() in the handler may work.
There are two ways to bind events in FloatCanvas (see examples of these
in the main demo, and various other demos:
1) Bind to the Canvas itself:
self.Canvas.Bind(FloatCanvas.EVT_LEFT_DOWN, self.MyCallback)
This is binding the FloatCanvas event, rather than the regular wx one --
it acts the same way, except that the event that gets passed to the
callback has the FloatCanvas world coordinates in it:
def MyCallback(self, event):
print "coords are: %s"%(event.Coords,)
2) Bind to specific FloatCanvas Objects:
DrawObject.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.ObjectGotHit)
What this does is then call that collback whenthe object is hit, and
rather than passing in an event, it passes in the Object itself (this
may be a design error -- it might make more sense to have it be more
similar to the regular old wx event binding...). That object has two
extra atrributes:
Object.HitCoords: The mouse coords in world coordinates
Object.HitCoordsPixel: Teh mouse coords in pixel coordinates.
Note that some GUIModes will capture the events and not let these
bindings get used. The GUIMouse will pass them all on.
> The reason for my needing to do this is that I want to automatically
> select a canvas pan mode if only the canvas itself is selected.
You should be able to build that kind of functionality into a GUIMode.
--
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://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas