I have a wxListCtrl that i want to keep in synch with a data structure. The user will be able to add, delete and modify the data from other controls on the frame, I want the list to update whenever the structure does. What is the best paradigm to use here?
One Idea I was considering was to implement the wxListCtrls paint event method, but i’m concerned with efficiency and it would be a pain to keep track of the selected item.
Right now I have created a “updateTable” method, and I just call it whenever the data structure gets modified. I’m pretty sure I’m going to create an infinite loop if I don’t re-design.
I suppose i could pass a function object..
Thanks in advance.
You could probably do this with a virtual list control. The wxPython demo has an example. I haven’t tried that before. Personally, I use ObjectListView, which is a wrapper on top of the ListCtrl. I find it much easier to use. You can see how I do it in this article: http://www.blog.pythonlibrary.org/2011/11/10/wxpython-and-sqlalchemy-an-intro-to-mvc-and-crud/