PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Listbox control refresh  (Read 245 times)

Bumblebee

  • Little Newbie
  • *
  • Posts: 44
Listbox control refresh
« on: May 21, 2020, 04:21: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.
Logged

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 9287
  • Windows 10
    • PlanetSquires Software
Re: Listbox control refresh
« Reply #1 on: May 21, 2020, 08:24: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.
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 9287
  • Windows 10
    • PlanetSquires Software
Re: Listbox control refresh
« Reply #2 on: May 21, 2020, 08:39: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.
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Bumblebee

  • Little Newbie
  • *
  • Posts: 44
Re: Listbox control refresh
« Reply #3 on: May 21, 2020, 06:23:50 PM »

I still have the refresh issue.
Logged

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 9287
  • Windows 10
    • PlanetSquires Software
Re: Listbox control refresh
« Reply #4 on: May 21, 2020, 06:44: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.
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Bumblebee

  • Little Newbie
  • *
  • Posts: 44
Re: Listbox control refresh
« Reply #5 on: May 21, 2020, 06:48:37 PM »

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

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 9287
  • Windows 10
    • PlanetSquires Software
Re: Listbox control refresh
« Reply #6 on: May 21, 2020, 07:41: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.
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Wilko Verweij

  • Junior Member
  • **
  • Posts: 163
  • PB10 - FF3.7 User; Win 10
    • CHEAQS
Re: Listbox control refresh
« Reply #7 on: May 22, 2020, 09:54: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
Logged