• Welcome to PlanetSquires Forums.
 

Listbox control refresh

Started by Bumblebee, May 21, 2020, 04:21:35 AM

Previous topic - Next topic

Bumblebee

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.
Failed pollinator.

Paul Squires

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.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

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.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Bumblebee

I still have the refresh issue.
Failed pollinator.

Paul Squires

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.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Bumblebee

If it causes flickering when items are added rapidly, then it might not be worth it..?
Failed pollinator.

Paul Squires

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.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Wilko Verweij

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

Bumblebee

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.
Failed pollinator.

jermy

in case no one noticed, the menu displays refresh twice

Paul Squires

Thanks guys, I have added your issues to my to-do list.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer