Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / Blue 2, Listboxes and lots of entries.

Author
Message
Narf The Mouse
19
Years of Service
User Offline
Joined: 16th Jul 2004
Location:
Posted: 28th Oct 2004 12:39
In one of the programs I am working on, hundreds of listbox entries can easily be added and it's one of the main features of the program. Unfortunatly, the listbox updates itself every time another entry is added. This slows it down enormously. I've tried turning off autoupdate, but that just means it waits to display the entries, I've tried setting it's visibility to 0 and disabling it, all using the v2 commands, but the time taken shows that it is still updating the listbox each time an entry is added. Help?

Cheese!
Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 28th Oct 2004 19:32 Edited at: 28th Oct 2004 19:33
The main delay in addItem is probably the fact that each time you add a new item, Windows has to allocate memory for that item.

Having said that, the delay should be very small.

On a P4 1.7Ghz processor, adding 200 items to a listbox takes only 60ms or 0.06 seconds. Adding 2000 items takes just over half a second.



If you are adding the items in a REPEAT, WHILE or DO loop, you will need to change compiler settings otherwise DBPro does a whole host of checks on every iteration of the loop. Either replace it with a FOR loop, or go into the Compiler\setup.ini file (The "Compiler" folder is inside the main DBPro install folder) and set "RemoveSafetyCode" to "yes".

Also make sure that there is no other slowdown in the code which adds the items.

If it does turn out to be Blue2's addItem command slowing things down, there are some Windows API calls which you can make which allocate the memory in one large block before adding the new items, which should improve performance, and I'll post some examble DB code for them.


BlueGUI:Windows UI Plugin - All the power of the windows interface in your DBPro games.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Oct 2004 21:53
Could it be that the listbox is being rendered every time a new item is added?

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk
Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 29th Oct 2004 01:18
I suspect not, because assuming that the ListBox is not big enough to show all of the items at once, only the scrollbar would need to be repainted. Plus the fact that setAutoUpdate does not make a difference means that rendering time is probably not the main issue. (setAutoUpdate causes gadgets to return immediately from any WM_PAINT calls, rather than painting the window)


BlueGUI:Windows UI Plugin - All the power of the windows interface in your DBPro games.
Narf The Mouse
19
Years of Service
User Offline
Joined: 16th Jul 2004
Location:
Posted: 29th Oct 2004 04:52 Edited at: 29th Oct 2004 04:57
Or, it could be the fact that I update the matrix in the function call in the for-next loop.

Thanks. I'll try to post less brainless questions.

Cheese!
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 29th Oct 2004 07:01
Doh!

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk

Login to post a reply

Server time is: 2024-04-16 15:01:41
Your offset time is: 2024-04-16 15:01:41