CListBox ... InitStorage()

  • Thread starter Thread starter jmarc
  • Start date Start date
J

jmarc

Doesn't seems to work!

Filling a CListBox with over 75,000 strings in it, took more than 5 minutes
!
I tried using InitStorage( nbitems, length_item ) before filling the
listbox,
and it doesn't seem to change anything. It supposed to be used to allocate
CListBox memory before using AddStgring() and InsertString().

Does anyone have succesfully used this InitStorage() function..???
(I'm not using Win 98.. whit listbox limited to 32 thousands.. then)

Thanks!
jmarc...
 
Have you posted this in the correct forum?

The InitStorage allocates memory for the items, but you won't notice any
difference as long as the UI is updated for every item you add.

Use BeginUpdate and EndUpdate to keep the control from updating while
you add items.
 
I'm sorry if this is not the right Newsgroup to post it!

Then.. No, the UI is not updated. But I will try
BeginUpdate and EndUpdate and see tghe result...

I track the qty of items to show. So, when the qty of items
to show is different, I do a ResetContent followed by many InsertString.
When the qty has not changed, I do many "InsertString/DeleteString"
for only items that have changed and need to be refreshed!

It seems to take time to displays on both algorythms...

Thanks!
jmarc....
 
Yes, the UI is not updated visually as long as you don't return control
to the windows message pump, but I think that the control rebuilds the
structures that is used by the UI.
 
Hoppefully, I had an alternatge bussines strategy to
offer to my client. I symply displays 2,000 items
alongs with a number indicating the right items amount.
But, it might be better to displays all of them int the
scrolling list.

By the way, there are no BeginUpdate and EndUpdate
in that MFC class. I use Visual C++ .NET (2003). And
Up to now, I don't see any change in time taken, whatever
the stategy taken to update the list..

I'll probably try to use AddString instead of InsertString,
when refreshing the whole list, and still keeping InsertString
and DeleteString when one, or few items, having to be updated.

Or, anyone have any other ideas!

Thanks !
jmarc...
 
Back
Top