Associating data with wxListCtrl in virtual mode

Vadim Zeitlin vadim at wxwindows.org
Tue Dec 12 02:09:20 PST 2006


On Tue, 12 Dec 2006 15:34:17 +0530 Lloyd <lloyd at cdactvm.in> wrote:

L> I know wxLC_VIRTUAL is meant for when we have 1000s of rows! If I try to
L> sort my huge vector each time, it will take considerable time! 
L> 
L> Can I solve this problem without sorting the vector?

 Only by maintaining a separate mapping between positions on the screen and
indices in the vector. This wouldn't be much faster if your vector contains
"small" objects (or pointers to large ones) though. It still can be a good
idea if you use the indices into this vector from other parts of your
program. In general I'd advise abstracting access to the data via methods
such as GetItemAtPosition() which would make it clear whether you access
the item by internal index or its position on screen and would allow you to
change the implementation later.

 Regards,
VZ

-- 
TT-Solutions: wxWidgets consultancy and technical support
               http://www.tt-solutions.com/





More information about the wx-users mailing list