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?
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
> 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()
> 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()
> 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()
>>> col.SetText("NEW TITLE")
>>> frame.demoPage.list.SetColumn(1, col)
http://wxPython.org Java give you jitters? Relax with wxPython!
I ran it on windows 2000. I tried the same as you did and it works for me. but if I use the demo listctrl_edit.py, it doesn't work. I tried it in py shell and the problem happened. after I set the new column title, the header became blank.
Yahoo! DSL Something to write home about. Just $16.99/mo. or less
> I thought I found the cause of the problem. if I commented line:
> self.list.SetImageList(self.il, wx.IMAGE_LIST_SMALL)
> in the demo file, the setcolumn can make the header blank. I can
> reproduce this issue repeatedly on windows 2000. is this a bug? why
> setcolumn has anything to do with setimagelist?
The item's mask is probably set to specify that the image is valid, and
so the listctrl is trying to set the image to an invalid index. Try