What I do with my Composit figures is to define a Rectangle as one of the subobjects of a Composit. I then make only the Rectangle object hitable and bind events to it. I set the fill and line style so that the Rectangle is normally 'invisible'. However when it is selected I change the fill or line style so that the Rectangle is visible. Now you can see which object is selected.
Run the demo I mailed before to see the effect. Have a look at my SchemSymbol class in SchemCore.py. You can probably just use it as your Composit base class and just add bitmap and text (or more) to it as required. Retief Gerber Lektor Lecturer Departement Elektriese en Elektroniese Ingenieurswese Department of Electrical and Electronic Engineering Tel: +27 21 808 4011 I Faks/Fax: +27 21 808 4981 E-pos/E-mail: [EMAIL PROTECTED] Universiteit Stellenbosch University Privaat Sak/Private Bag X1 Matieland 7602 Suid-Afrika/South Africa www.eng.sun.ac.za From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marco Meoni - Sbaush Sent: 25 May 2007 11:53 AM To: Mailing List for the wxPython Float Canvas. Subject: Re: [fc] Link two Binding Object Thanks lot for the attachment. I used it for create a mine composite HostShape, but i have much problem on dragging and binding events on composite shape. With an approssimative CalcBoundingBox method i can draw the objects in the canvas, but i cant bind the events on it. Now the drown object are unclickable. To add my HostShape in the canvas i use: self.Canvas.AddObject(hostShape) hostShape.Bind(FC.EVT_FC_LEFT_DOWN, self.ObjectHit) Now my HostShape class is this: class HostShape(FC.DrawObject,MovingObjectMixin, ConnectorObjectMixin): def __init__(self, parent, point, testo, tipo,boundingbox=None, InForeground=False,IsVisible=True): self.point=point (x,y)=point self.__hitable = False self.textPoint=(x,y-1) self.pluginPath = parent.pluginPath self.Canvas=parent.Canvas FC.DrawObject.__init__(self, InForeground, IsVisible) if tipo == 'host': self.bmp = wx.Image (self.pluginPath + 'host.png',wx.BITMAP_TYPE_PNG).ConvertToBitmap() if tipo == 'router': self.bmp = wx.Image(self.pluginPath + 'router.png',wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.shape=MovingBitmap(self.bmp, self.point, Height = 3.5, Position = "bc") self.text = MovingText(testo, self.textPoint, Size = 1, Position = "tc") self.CalcBoundingBox() def _Draw(self, dc , WorldToPixel, ScaleWorldToPixel, HTdc=None): self.shape._Draw(dc , WorldToPixel, ScaleWorldToPixel, HTdc=None) self.text._Draw(dc , WorldToPixel, ScaleWorldToPixel, HTdc=None) How can i write a correct CalcBoundingBox method? -- Marco Meoni (Sbaush)
<<image001.gif>>
<<image003.jpg>>
_______________________________________________ FloatCanvas mailing list [email protected] http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas
