title: wx.ListCtrl: how can I select a row on EVT_RIGHT_DOWN?
body: <p>I'm writing a simple database GUI with wxpython.</p>
  
  <p>In order to display my database entries, I'm using a <a href="http://www.wxpython.org/docs/api/wx.ListCtrl-class.html" rel="nofollow"><code>wx.ListCtrl</code></a>. Let's consider the following code snippet:</p>
  
  <pre><code>class BookList(wx.ListCtrl):
    def __init__(self, parent, ID=wx.ID_ANY):
      wx.ListCtrl.__init__(self, parent, ID)
  
      self.InsertColumn(0, 'Title')
      self.InsertColumn(1, 'Author')
  
      # set column width ...
  
      self.Bind(wx.EVT_RIGHT_DOWN, self.OnRightDown)
  
  
    def OnRightDown(self, event):
      menu = wx.Menu()
      delete = menu.Append(wx.ID_ANY, 'Delete Item')
  
      self.Bind(wx.EVT_MENU, self.OnDelete, delete)
  
      # select row
  
      self.PopupMenu(menu, event.GetPosition())
  </code></pre>
  
  <p>I can't figure out how to select the row before spawning the menu. </p>
  
  <p>I thought about two possible solutions:</p>
  
  <ol>
  <li>Use <a href="http://www.wxpython.org/docs/api/wx.ListCtrl-class.html#Select" rel="nofollow"><code>wx.ListCtrl.Select()</code></a>, but I don't know how to obtain <code>idx</code> parameter corresponding to the row I want to select.</li>
  <li>Trigger <code>wx.EVT_LEFT_DOWN</code>, but I don't know how (and even if) it could be done.</li>
  </ol>
  
  <p>Am I on the right way? Is there any better solution?</p>
  
  <p>Thanks in advance.</p>