FloatCanvas object with context menu

Hi,

Not sure where the solution for this is wx or FloatCanvas and as I know Chris is reading this one as much as the FC list I'll post it here.

In my rack viewer I have a two maybe more actions I like the user to have on an item, so wanted to show a context menu.

     for item in controller._itemsToBind:
         item.Bind(fc.EVT_FC_LEFT_DOWN, controller.objectHit)
         item.Bind(fc.EVT_FC_RIGHT_DOWN, controller.objectHitR)

Initially I had this and in "objectHitR" I would call the context menu, it does show but the selected menu handler is never called.

So, I wanted to bind wx.EVT_CONTEXT_MENU, but then I get the following exception.

Ideally I like to just create the context menu from within objectHitR as I need some stuff from the object hit. Can I do this in a way that the context menu handler thinks it is being called from a wx.EVT_CONTEXT_MENU and not from a fc.EVT_FC_RIGHT_DOWN event?

Werner

KeyError: <wx._core.PyEventBinder object at 0x02B2B4D0>
File "c:\dev\twcbv4\twcbsrc\controllers\dwinerack.py", line 268, in <module>
   dlg.ShowModal()
File "c:\Python27\Lib\site-packages\wx-2.9.5-msw\wx\_windows.py", line 805, in ShowModal
   return _windows_.Dialog_ShowModal(*args, **kwargs)
File "c:\Python27\Lib\site-packages\wx-2.9.5-msw\wx\lib\agw\aquabutton.py", line 434, in OnLeftUp
   self.Notify()
File "c:\Python27\Lib\site-packages\wx-2.9.5-msw\wx\lib\agw\aquabutton.py", line 864, in Notify
   self.GetEventHandler().ProcessEvent(evt)
File "c:\Python27\Lib\site-packages\wx-2.9.5-msw\wx\_core.py", line 4154, in ProcessEvent
   return _core_.EvtHandler_ProcessEvent(*args, **kwargs)
File "c:\dev\twcbv4\twcbsrc\controllers\dwinerack.py", line 216, in onViewerButton
   viewer.viewRack(selObj)
File "c:\dev\twcbv4\twcbsrc\controllers\fwinerackview.py", line 603, in viewRack
   self.loadRack()
File "c:\dev\twcbv4\twcbsrc\controllers\fwinerackview.py", line 612, in loadRack
   rutils.loadRack(self, rackDoc, viewer=True)
File "c:\dev\twcbv4\twcbsrc\tools\rack_utils.py", line 457, in loadRack
   item.Bind(wx.EVT_CONTEXT_MENU, controller.onContextMenu)
File "c:\Python27\Lib\site-packages\wx-2.9.5-msw\wx\lib\floatcanvas\FloatCanvas.py", line 279, in Bind
   self._Canvas.HitDict[Event][self.HitColor] = (self) # put the object in the hit dict, indexed by its color

Hi,

Forget it, reading other posts and wiki entries etc about context menu I realized it didn't matter how I called PopupMenu.

My problem was that I had the context menu Bind done on my controller (wx.EvtHandler) instead of on my view (wx.Frame) - one of these copy/paste errors:-(

Sorry for the noise.
Werner