[wxPython] popup menus in a grid

The new grid is working well for me now. I would like to add some
popup-menus that are to be brought up by right-clicking on a cell.
I can capture the right-click with

  ...
        EVT_GRID_CELL_RIGHT_CLICK( self.grid, self.OnCellRClick )
  ...

And in the handler I can get the row/col of the cell in question with
GetRow() and GetCol() on the event...

    def OnCellRClick(self, event):

        menu = wxMenu()
        selectID = 0
        filterID = 0
        menu.Append(selectID, "Select")
        menu.Append(filterID, "Filter")
        EVT_MENU(self, selectID, self.OnSelect)
        EVT_MENU(self, filterID, self.OnFilter)

        row,col = event.GetRow() )
        x,y = ???,???
        self.PopupMenu(menu, wxPoint(x,y))
        menu.Destroy()

But, how can I turn this row/column into the x,y coodinates suitable
to pass to the PopupMenu method? None of the methods mentioned in the
grid.i class seem to do what I require. The listctrl demo code seems
to capture the x,y with a separate callback for EVT_RIGHT_DOWN(), but
this event does not appear to be generated in a grid.

Any pointers?

Thanks

Tim Docker

The trick is to not try and turn the row/column into x,y coordinates, but to just ask the event itself.
Here's a simple handler from my grid testing class:

     def OnRightClick(self,event):
         pos = event.GetPosition()
         print 'rclick:',pos.x,pos.y

Hope this helps,
-greg

···

At 06:19 PM 6/27/2000 +1000, Timothy Docker wrote:

But, how can I turn this row/column into the x,y coodinates suitable
to pass to the PopupMenu method? None of the methods mentioned in the
grid.i class seem to do what I require. The listctrl demo code seems
to capture the x,y with a separate callback for EVT_RIGHT_DOWN(), but
this event does not appear to be generated in a grid.

----
greg Landrum (greglandrum@earthlink.net)
Software Carpenter/Computational Chemist