PlanetSquires Forums

Support Forums => PlanetSquires Software => Topic started by: Bumblebee on May 21, 2020, 04:51:35 AM

Title: Listbox control refresh
Post by: Bumblebee on May 21, 2020, 04:51:35 AM
Is it normal for a listbox control to not update its contents during a loop?
In the attached demo, only the scroll bars get updated. No items are shown during operation of the loop.

If it is normal, I will set the TopIndex or Refresh properties as needed.
Title: Re: Listbox control refresh
Post by: Paul Squires on May 21, 2020, 08:54:53 AM
The listbox should update after every addition to the list. I downloaded your sample and, yes, it does not appear to be refreshing. I will look at the code for that to ensure that the display is updated after every add. Thanks for the report.
Title: Re: Listbox control refresh
Post by: Paul Squires on May 21, 2020, 09:09:39 AM
Can you please unzip the attached archive and overwrite the existing files in this folder:

\WinFBE_Suite\FreeBASIC-1.07.1-gcc-5.2\inc\WinFormsX

Please let me know if the refresh issue is corrected.
Title: Re: Listbox control refresh
Post by: Bumblebee on May 21, 2020, 06:53:50 PM
I still have the refresh issue.
Title: Re: Listbox control refresh
Post by: Paul Squires on May 21, 2020, 07:14:22 PM
Thanks - I figured that you might. I will add an explicit refresh in the library to ensure that the WM_DRAWITEM message gets generated by Windows.
Title: Re: Listbox control refresh
Post by: Bumblebee on May 21, 2020, 07:18:37 PM
If it causes flickering when items are added rapidly, then it might not be worth it..?
Title: Re: Listbox control refresh
Post by: Paul Squires on May 21, 2020, 08:11:18 PM
I could add functionality similar to the Listview where when adding a bulk number of items you can call BeginUpdate and when finished adding you call EndUpdate. The Listbox implementation already uses double buffering with offscreen bitmaps so the amount of flicker should be low. I will do some tests to see if adding the refresh produces enough flicker to warrant adding the BeginUpdate/EndUpdate syntax.
Title: Re: Listbox control refresh
Post by: Wilko Verweij on May 22, 2020, 10:24:41 AM
I believe the default behavior of a listbox is that it refreshes after each addition. For adding large numbers of items, you could apply the LBS_NOREDRAW message combined with manual updating afterwards (WM_SetRedraw). Maybe this helps
Title: Re: Listbox control refresh
Post by: Bumblebee on August 03, 2020, 11:08:53 AM
Another small issue that I'm observing in Windows 7...
When an item is selected near the bottom of a listbox and some items are removed programmatically, a gap is left at the bottom.

In the demo, click on Populate.
When the process is complete, a listbox item will be selected.
Click on Remove to see if the gap appears in your version of Windows.
Title: Re: Listbox control refresh
Post by: jermy on August 05, 2020, 08:07:22 PM
in case no one noticed, the menu displays refresh twice
Title: Re: Listbox control refresh
Post by: Paul Squires on August 07, 2020, 04:02:09 PM
Thanks guys, I have added your issues to my to-do list.