Listbox - scroll insanely slow/choppy with mouse wheel but not scrollbar?

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
User avatar
raphaelgj
Posts: 19
Joined: Tue Jun 19, 2018 10:19 am

Listbox - scroll insanely slow/choppy with mouse wheel but not scrollbar?

Post by raphaelgj » Tue Jan 15, 2019 12:00 pm

I have a simple listbox with around 70 items in it.
If I click and move the SCROLLBAR, it's really smooth and there is no delay whatsover.
If I scroll with the MOUSEWHEEL, it's incredibly choppy and delayed, slow.

Why is that and how can it be fixed?

Check this recording to see it in action using the simplest example:
https://imgur.com/a/ckROd2E

In the example I scroll the mousewheel fast so it should go to the top quickly but it "lags" all the way in a very delayed fashion.
That would be very frustrating for the end user. :)

User avatar
jvierra
Posts: 13392
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Listbox - scroll insanely slow/choppy with mouse wheel but not scrollbar?

Post by jvierra » Tue Jan 15, 2019 12:36 pm

The scroll increment is set too high. The scroll on a ListBox can only be set by line - the scrollbar moves by pixel. The system and user preferences control this.

Here are two files. Place them in a new temp folder and open the PSF and run it. It is a demo of how to use a ListBox and also scrolls smoothly. If it doesn't on your system then check your system settings.

The CSV file is a good one to have as it is a complete file of all states and cities and is used here to show how to set up synchronized views with two ListBoxes.
Attachments
StateCity.csv
(3.16 MiB) Downloaded 10 times
Demo-ListboxDatabindingWithViews.psf
(23.22 KiB) Downloaded 10 times

User avatar
raphaelgj
Posts: 19
Joined: Tue Jun 19, 2018 10:19 am

Re: Listbox - scroll insanely slow/choppy with mouse wheel but not scrollbar?

Post by raphaelgj » Tue Jan 15, 2019 12:45 pm

Thank you, however the same behaviour is present. If I give the scrollwheel a long scroll, it will scroll up the distance but not instantly like it would in notepad for example, it does it over 1-2 seconds...

User avatar
jvierra
Posts: 13392
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Listbox - scroll insanely slow/choppy with mouse wheel but not scrollbar?

Post by jvierra » Tue Jan 15, 2019 1:13 pm

Then your issue is not a scripting issue. It is a system issue and you need to check your mouse settings. The issue may also be a result of a high DPI monitor. If so then you will need to set the form up for high DPI use.

User avatar
davidc
Posts: 5805
Joined: Thu Aug 18, 2011 4:56 am

Re: Listbox - scroll insanely slow/choppy with mouse wheel but not scrollbar?

Post by davidc » Wed Jan 16, 2019 9:12 am

In regards to high DPI, I recommend this article:

https://info.sapien.com/index.php/guis/ ... i-displays
David
SAPIEN Technologies, Inc.

Locked