ListCtrl with TextEditMixin and CheckListCtrlMixin

I'm trying to create a list control that combines both the TextEditMixin and CheckListCtrlMixin where the first column of the list would contain just a checkbox and the subsequent columns contain editable text.
It mostly works but I'm running into two problems.
1) I can only toggle the checkbox on non-selected rows. If a row is selected, I cannot toggle the checkbox.

2) Clicking on column 0 brings up a text editor for that column. I'd like to prevent his from happening.

Has anyone implemented something like this before? Hopefully this makes sense. My __init__ code is below.

class PunchList(wx.ListCtrl, listmix.CheckListCtrlMixin, listmix.ListCtrlAutoWidthMixin, listmix.TextEditMixin):
   def __init__(self, parent, question):
       wx.ListCtrl.__init__(self, parent, -1, style=wx.LC_REPORT | wx.LC_VRULES | wx.LC_HRULES)
       listmix.CheckListCtrlMixin.__init__(self)
       listmix.ListCtrlAutoWidthMixin.__init__(self)
                   self.question = question
             self.InsertColumn(0, "")
       self.SetColumnWidth(0, 30)
       self.InsertColumn(1, "#")
       self.SetColumnWidth(1, 30)
       self.InsertColumn(2, "Punch Text")
       self.SetColumnWidth(2, wx.LIST_AUTOSIZE)

       listmix.TextEditMixin.__init__(self)

Andrew Mercer <andrew.mercer <at> gmail.com> writes:

I'm trying to create a list control that combines both the TextEditMixin
and CheckListCtrlMixin where the first column of the list would contain
just a checkbox and the subsequent columns contain editable text.
It mostly works but I'm running into two problems.
1) I can only toggle the checkbox on non-selected rows. If a row is
selected, I cannot toggle the checkbox.

2) Clicking on column 0 brings up a text editor for that column. I'd
like to prevent his from happening.

Andrew,

Below is an example that works (adapted from something found I don't remember
where...). The 2 problems you mention do not appear in this example.

Dominique

#! /usr/bin/env python
# -*- coding: utf-8 -*-

import wx
import sys
from wx.lib.mixins.listctrl import ListCtrlAutoWidthMixin,
CheckListCtrlMixin,TextEditMixin

actresses = [('jessica alba', 'pomona', '1981'), ('sigourney weaver', 'new
york', '1949'),
    ('angelina jolie', 'los angeles', '1975'), ('natalie portman', 'jerusalem',
'1981'),
    ('rachel weiss', 'london', '1971'), ('scarlett johansson', 'new york', '1984' )]

class AutoWidthListCtrl(wx.ListCtrl,
ListCtrlAutoWidthMixin,CheckListCtrlMixin,TextEditMixin):
    def __init__(self, parent):
        wx.ListCtrl.__init__(self, parent, -1, style=wx.LC_REPORT)
        ListCtrlAutoWidthMixin.__init__(self)
        CheckListCtrlMixin.__init__(self)
        TextEditMixin.__init__(self)

class Actresses(wx.Frame):
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title, size=(380, 230))

        hbox = wx.BoxSizer(wx.HORIZONTAL)

        panel = wx.Panel(self, -1)

        self.list = AutoWidthListCtrl(panel)
        self.list.InsertColumn(0, 'name', width=140)
        self.list.InsertColumn(1, 'place', width=130)
        self.list.InsertColumn(2, 'year', wx.LIST_FORMAT_RIGHT, 90)

        for i in actresses:
            index = self.list.InsertStringItem(sys.maxint, i[0])
            self.list.SetStringItem(index, 1, i[1])
            self.list.SetStringItem(index, 2, i[2])

        hbox.Add(self.list, 1, wx.EXPAND)
        panel.SetSizer(hbox)

        self.Centre()
        self.Show(True)

if __name__ == '__main__':
    app = wx.App()
    Actresses(None, -1, 'actresses')
    app.MainLoop()

Andrew Mercer <andrew.mercer <at> gmail.com> writes:

Dominique wrote:
> Andrew Mercer <andrew.mercer <at> gmail.com> writes:
>
This example actually seems to have the same problem. I tried it on
both OS X and Windows XP to see if it was a platform quirk. What
happens is if a row is selected and you click on the checkbox, rather
than activate the checkbox, it activates the text control.

Is there any way to give the checkbox priority over the textbox?
>

Andrew,
You are right. Same thing here (win xp). On this, I can't help you but I am also
interested in getting the answer.
For the 2) (click on column 0 opens the editor), I don't have this behaviour.
Nothing happens.
Hope we'll get the answer
Dominique