Search code examples
pythonwxpythonobjectlistview

python ObjectListView has a single un-editable column


I have a ObjectListView that I have made editable with

self.TrackOlv.cellEditMode = ObjectListView.CELLEDIT_SINGLECLICK

The gives me 2 odd issues.

1) I can't edit the first cell/column. Is this due to OLV treating it like a primary key or something to that effect? I assume I can get around it by creating another attribute to my object and then just not displaying it, but that seems kind of cheesy.

2) I have about 4 chars worth of white space before the first char of my first column. Is this normal? This includes the standard blue/yellow line color effect. I have the white space, then the column text and color effect will begin. Its not a big deal, just wonder if its normal.


Solution

  • 1.) For each column have you added isEditable=True?

    first_col = ColumnDefn('Name', 'left', -1, 'name', isEditable=True)
    

    This works perfectly for me in my OLV, along with having;

    self.TrackOlv.cellEditMode = self.TrackOlv.CELLEDIT_SINGLECLICK
    

    2.) You can read why this is the case here. Basically, if you don't need sorting, you can get rid of this gap.