Ogl.LineShape Event handling problem

Hi, I’m having some problems with event handling with
ogl.LineShapes.

My application allows the user to draw lines and delete them
with a right click. This works fine when the line is simply a straight line
with 2 control points.

However, when I use the InsertLineControlPoint method to add
2 more control points, the event handling fails. It does not capture the OnRightDown
event for some reason.

I am developing on Windows XP, with Python2.5 and wxPython
2.8.8.1.

Here is my code:

def **drawLine**(*self*,

btn1, btn2):

    line = ogl.LineShape()

    line.SetCanvas(*self*)

line.SetPen(wx.GREEN_PEN)

line.SetBrush(wx.BLACK_BRUSH)

line.AddArrow(ogl.ARROW_ARROW)

    line.MakeLineControlPoints(2)

   

    if btn1.isRed == btn2.isRed:

if btn1.isRed == True:

offset = 50

else:

offset = -50

line.InsertLineControlPoint(None,
wx.Point(btn1.GetX()+offset,btn1.GetY()))

line.InsertLineControlPoint(None,
wx.Point(btn2.GetX()+offset,btn2.GetY()))

    evthandler =

LineEvtHandler(self.log, self.parent)

evthandler.SetShape(line)

    evthandler.SetPreviousHandler(line.GetEventHandler())

line.SetEventHandler(evthandler)

    *self*.diagram.AddShape(line)

    btn1.AddLine(line,btn2)

    line.Show(True)

self.Refresh()

class LineEvtHandler(ogl.ShapeEvtHandler):

def **__init__**(*self*,

log, frame):

ogl.ShapeEvtHandler.init(self)

    *self*.log = log

    *self*.parentFrame = frame

   

*"""*
  • Deletes the virtual
    

circuit*

  • “”"*
def **OnRightClick**(*self*, x, y, keys=0, attachment=0):

    line = *self*.GetShape()

    canvas =

line.GetCanvas()

    line.Unlink()

    line.Delete()

canvas.Refresh()

Thanks in
advance.