column header doesn't change

Hi,

I have following code to change column header of a wxlistctrl object on the fly.

def OnEditLabel(event, self=self, para=“test”):
mycol = self.GetColumn(self.currentItem)
mycol_old = self.event.GetColumn()
mycol.SetColumn(mycol_old)
dlg = wx.TextEntryDialog(self, MSG_ENTER_NODE_NAME, INSERT_NODE_DIALOG, mycol.GetText(), wx.OK | wx.CANCEL)
if dlg.ShowModal() == wx.ID_OK:
res = dlg.GetValue()
mycol.SetText(res)

    self.SetColumn(self.currentItem, mycol)

The method is invoked when user right clicks on a column header, a small message window will pop up with current header value. after user changes the value in the window and click ok button, I am expecting the column is showing the changed header. however, it shows blank. if I click on the header and show the message window again, it shows the changed the value. seems the header is not refreshed correctly. is this a bug?

thanks,
Anstoss

···

Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Anstoss wrote:

Hi,

I have following code to change column header of a wxlistctrl object on the fly.

def OnEditLabel(event, self=self, para="test"):
            mycol = self.GetColumn(self.currentItem)
            mycol_old = self.event.GetColumn()
            mycol.SetColumn(mycol_old)
            dlg = wx.TextEntryDialog(self, MSG_ENTER_NODE_NAME, INSERT_NODE_DIALOG, mycol.GetText(), wx.OK | wx.CANCEL)
            if dlg.ShowModal() == wx.ID_OK:
                res = dlg.GetValue()
                mycol.SetText(res)
                self.SetColumn(self.currentItem, mycol)

The method is invoked when user right clicks on a column header, a small message window will pop up with current header value. after user changes the value in the window and click ok button, I am expecting the column is showing the changed header. however, it shows blank. if I click on the header and show the message window again, it shows the changed the value. seems the header is not refreshed correctly. is this a bug?

Platform and version? The following works for me in the ListCtrl sample in the demo, (run it and then press F5 to open a PyShell window):

  >>> col = frame.demoPage.list.GetColumn(1)
  >>> print col.GetText()
  Title
  >>> col.SetText("NEW TITLE")
  >>> frame.demoPage.list.SetColumn(1, col)
  True

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!