wx.List_Edit and masked.NumCtrl ?

Hi,

I want to restrict values entered in a cell of a listctrl, i.e. only
num/ float allowed.

I have a class like this:

class TestVirtualList(wx.ListCtrl,listmix.TextEditMixin):
    def __init__(self, parent,):
        wx.ListCtrl.__init__(
            self, parent, -1,
            style=wx.LC_REPORT|wx.LC_HRULES|wx.LC_VRULES|wx.LC_MASK_TYPE,
            )
        listmix.TextEditMixin.__init__(self)

I thought I could mask the cell(s) somehow but cannot figure out how. My
alternative would be an event, but I thought there might be a more
elegant way to do this ...
Any suggestions?

Thanks,

T

It looks like you can override the TextEditMixin.make_editor method and then create the textctrl or numctrl however you want. It may get tricky if you want to use different masks or whatever in different columns, but it's probably doable. Another option would be to set a Validator on the textctrl, then it could be a little easier to make it more dynamic based on the current column being edited, etc.

···

On 3/27/12 10:19 AM, Tobias Weber wrote:

Hi,

I want to restrict values entered in a cell of a listctrl, i.e. only
num/ float allowed.

I have a class like this:

class TestVirtualList(wx.ListCtrl,listmix.TextEditMixin):
     def __init__(self, parent,):
         wx.ListCtrl.__init__(
             self, parent, -1,
             style=wx.LC_REPORT|wx.LC_HRULES|wx.LC_VRULES|wx.LC_MASK_TYPE,
             )
         listmix.TextEditMixin.__init__(self)

I thought I could mask the cell(s) somehow but cannot figure out how. My
alternative would be an event, but I thought there might be a more
elegant way to do this ...
Any suggestions?

--
Robin Dunn
Software Craftsman