开发者

Adding items to an object with ObjectListView

After reading some items here I have decided to rewrite a little project using ObjectListView. My problem is that when I try to do self.ListObject.AddObject(object) to add an item to my list it fails, and I am not sure why.

Here is the code where I let the user select a destination dir. At the end of the selection process it is supposed to update the ObjectListView of ActionsOlv with a timestamp and the action taken. Print statements are for debug only.

def onBrowseDest(self, event):
    print "OnBrowseDest"    
    dest = selectFolder("Select the Destination Directory")

    print dest

    self.txDest.SetValue(dest)
    self.anEvent = [Action(datetime.datetime.now(),dest开发者_Go百科,"Set as Destination dir")]
    self.ActionsOlv.AddObject(self.anEvent)

What is occuring is that I see lines being created in the list, but there is not any content to the line. If I replace the AddObject method with SetObjects

    self.ActionsOlv.SetObjects(self.anEvent)

it will update the display, but each newline overwites the list instead of adding to it.


I figured the issue out. I needed to use AddObjects, no AddObject

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜