|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
CListBox ... InitStorage()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. jmarc wrote: Show quote > 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... > > 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.... Show quote "Göran Andersson" <gu***@guffa.com> wrote in message news:eOJhjuCcGHA.1516@TK2MSFTNGP05.phx.gbl... > 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. > > jmarc wrote: >> 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... 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. jmarc wrote: Show quote > 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.... > > > "Göran Andersson" <gu***@guffa.com> wrote in message > news:eOJhjuCcGHA.1516@TK2MSFTNGP05.phx.gbl... >> 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. >> >> jmarc wrote: >>> 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... > > 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... Show quote "Göran Andersson" <gu***@guffa.com> wrote in message news:O6BE%23RFcGHA.1204@TK2MSFTNGP02.phx.gbl... > 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. > > jmarc wrote: >> 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.... >> >> >> "Göran Andersson" <gu***@guffa.com> wrote in message >> news:eOJhjuCcGHA.1516@TK2MSFTNGP05.phx.gbl... >>> 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. >>> >>> jmarc wrote: >>>> 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... >> |
|||||||||||||||||||||||