Editing a column value in a report mode list control seems to be properly
working, but I cannot get the changed value to display. I suspect it has
something to do with the use of SetStringItem().However, 'WTH2' does not display; it remains 'WTH'. The code in the 'if'
loop is the same as that in the add method, so I do not understand why the
new value does not replace the original value in the displayed list
control.Oops! Mea culpa. It does display the new value(s), but in a new row in the
display. It's not replacing the modified row.
Well, sure it does, and I'm a little surprised you didn't see this as soon as you typed the code.
if result == wx.ID_OK:
self.co = modRule.pName.GetValue()
self.su = modRule.sName.GetValue()
self.va = modRule.vName.GetValue()
self.rn = modRule.rNum.GetValue()
self.ru = modRule.rule.GetValue()
# Replace changed values
self.rulesList.InsertStringItem(idx, self.co)
print 'Row number: ', idx
self.rulesList.SetStringItem(idx, 1, self.su)
self.rulesList.SetStringItem(idx, 2, self.va)
self.rulesList.SetStringItem(idx, 3, self.rn)
print 'Writing values: ', self.rn
self.rulesList.SetStringItem(idx, 4, self.ru)
You are calling "InsertStringItem". The purpose of InsertStringItem is to add a new empty row. If you want to change column 0 in the existing row "idx", then use the same function you use to change columns 1 through 4 in an existing row:
self.rulesList.SetStringItem( idx, 0, self.co )
···
On Mon, 12 May 2008 09:03:15 -0700 (PDT), Rich Shepard <rshepard@appl-ecosys.com> wrote:
On Mon, 12 May 2008, Rich Shepard wrote:
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.