Problem updating Multicolumn list widget (via Pythoncard)

Pythoncard has a multicolumn list widget based on these classes
from wx.lib.mixins.listctrl import ColumnSorterMixin, ListCtrlAutoWidthMixin

and wx.ListCtrl

I've got a 5 -col multicolumn list widget displayed, with 30 rows of
text in 5 columns.
When I try to update 1 row using an assignment similar to this

self.components.theList.items[0] = [ 'COL1', 'COL2', 'COL3', 'COL4', 'COL5']
(COL1, COL2 etc, is just some dummy text in the "body" of the list,
NOT the header rows)

the list widget is not being updated.

I've got a breakpoint set just before AND after the the line above, so
I can see the contents of the list and do not see the update
occurring, nor do I see any exceptions preventing the update from
occurring.

I've also tried using GetItemDataMap() and SetItemDataMap() and again,
the list widget is not being assigned the text.
I was able to successfully add 30 rows of text to the list widget
initially, but it appears I cannot change the contents of the rows
after the initial assignment.

Are there some side affects of the wxlistCtrl I'm not aware of?

Hi,

You could try it this way.

idx = 0 # the index number of the row
i = 0
for val in ['COL1', 'COL2', 'COL3', 'COL4', 'COL5']:
  self.components.theList.SetStringItem(idx, i, val)
  i += 1

···

On Mon, Mar 17, 2008 at 6:28 AM, Tony Cappellini <cappy2112@gmail.com> wrote:

self.components.theList.items[0] = [ 'COL1', 'COL2', 'COL3', 'COL4', 'COL5']
(COL1, COL2 etc, is just some dummy text in the "body" of the list,
NOT the header rows)

---
Charles

Assigning a new value to theList.items - doesn’t that update the whole list,

rather than just 1 item? That’s very inefficient, so I rather wouldn’t do

that.

Yes, inefficient it would be. But since items is a property, we cannot

update part of it using index to call the setter, CMIIW.

There are a number of SetItemXXX()/GetItemXXX() calls on the ListCtrl but they all don’t take the column-number, only the row number, and they don’t accept a tuple of values either like Append() does. FindItem() also looks in the first column only. This is actually one of my big sources of frustration with the ListCtrl.

Only after quite a long search did I find SetStringItem() which allows me to update individual columns.
I have no idea what setting the ListCtrl.item - property will do on a list with multiple columns - I never experimented with it. I hope that it will not just mimick the effects of SetItemXXX() calls. :wink:

Cheers,

–Tim

···

On Mon, Mar 17, 2008 at 11:49 AM, Charles peacech@gmail.com wrote:

On Mon, Mar 17, 2008 at 5:19 PM, Tim van der Leeuw tnleeuw@gmail.com wrote:


Charles


To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org

For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org