From: hapalibashi on 22 Oct 2009 15:00 ASked on stackoverflow but nobody is biting. I have a continuous stream of data that I want to place into a container. This container will either be of fixed size or dynamically constrained to a certain size at runtime. The latter may be preferable. When the container is full, the oldest data will be removed. I want to display this data using a wxVListBox because I need full control of the display. However there is a problem: the calls to OnDrawItem are not atomic meaning that once the container is full, each call the OnDrawItem will be accessing moving data, the result will be a non-contiguous display with missing elements. This is certainly true with any container with native array-like indexing, are required by OnDrawItem. I can simulate array-like indexing in a std::map using iterator indexing, if the key is sequential integer, then all the items will be ordered and the map can be pruned quite easily, but that seems like an inefficient hack. How can I solve this? Any other ideas or containers I haven't thought of?
From: hapalibashi on 23 Oct 2009 06:46 On Oct 22, 8:00 pm, "hapaliba...(a)googlemail.com" <hapaliba...(a)googlemail.com> wrote: > ASked on stackoverflow but nobody is biting. > > I have a continuous stream of data that I want to place into a > container. This container will either be of fixed size or dynamically > constrained to a certain size at runtime. The latter may be > preferable. > > When the container is full, the oldest data will be removed. > > I want to display this data using a wxVListBox because I need full > control of the display. However there is a problem: the calls to > OnDrawItem are not atomic meaning that once the container is full, > each call the OnDrawItem will be accessing moving data, the result > will be a non-contiguous display with missing elements. > > This is certainly true with any container with native array-like > indexing, are required by OnDrawItem. > > I can simulate array-like indexing in a std::map using iterator > indexing, if the key is sequential integer, then all the items will be > ordered and the map can be pruned quite easily, but that seems like an > inefficient hack. > > How can I solve this? Any other ideas or containers I haven't thought > of? The best approach seems to be to manage the full container state lazily within OnDrawBackground. That way the UI itself ensures the data remains static in the subsequent calls to OnDrawItem, using a deque as the container.
|
Pages: 1 Prev: wxcommunity and jet backup Next: wxPostEvent and wxRichTextCtrl problem |