Hi all,
I was hoping for a little direction on this one. I have written a program which uses a virtual wxListCtrl to talk to a mySQL database and fill itself with data. I am having some trouble implementing the "virtualness" of this list control.
I know how it all works, and have got it to work for me, but this is the situation. Ideally, I need to do some sort of serverside query to determine the size of the virtual list control first, then I need to make sure the OnGetItemText() method can provide the right data. So, in a perfect world, I would just query the database for it in the OnGetItemText() method. This would be fine, but this method is called hundreds of times when the mouse is moving over the list control. It would be realtime, but obciously not good in the speed department...
What is the normal way of handling this situation? You need to keep some sort of cache of records somewhere, but how do you know when to update them? It seems this would be a common thing to do, and what the virtual list control was created for. I am obviously missing something.
Currently, I am not using the "virtualness" of the control at all. I do a database query, and store the entire result in a list. Then I set the length of the list control, and my OnGetItemText() just pulls the right value out of the local list of records.
There has got to be some sort of balance between realtime updating of the list control with the database - record by record, and a static local copy that isn't virtual at all.
Any help would be appreciated - pointing me to source or a tutorial would be great.
Thanks,
Mark.