erbridge
erbridge

Reputation: 1386

Can I create a drop down combo box within a list control in wxPython?

I am creating a wx.ListCtrl (wxPython 2.8.11.0, Python 2.7) with style=wx.LC_REPORT|wx.LC_VRULES|wx.LC_SINGLE_SEL containing a score column (amongst others). Is it possible to make the score for each item (in order of preference):

  1. a drop down list of possible scores

  2. allow for typing into that column only (I am aware of, though have never used, wx.lib.mixins.listctrl.TextEditMixin)?

EDIT: This needs to be a cross-platform solution.

Upvotes: 2

Views: 2692

Answers (1)

Mike Driscoll
Mike Driscoll

Reputation: 33111

You can override the OnBeginEdit and check which column has been clicked in using event.m_col and act accordingly (i.e. event.Veto() or not). I don't think you can do a drop down in the cell itself, but you could create a simple dialog that does the same thing when the user clicks on that column. Or you might want to look at the UltimateListCtrl, a pure Python implementation of the ListCtrl that can do just about anything you want.

Upvotes: 4

Related Questions