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.
This topic is 5 years and 2 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
raphaelgj
Posts: 23
Last visit: Thu Aug 17, 2023 8:41 am

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

Post by raphaelgj »

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. :)
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

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

Post by jvierra »

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 187 times
Demo-ListboxDatabindingWithViews.psf
(23.22 KiB) Downloaded 133 times
User avatar
raphaelgj
Posts: 23
Last visit: Thu Aug 17, 2023 8:41 am

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

Post by raphaelgj »

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...
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

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

Post by jvierra »

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: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

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

Post by davidc »

In regards to high DPI, I recommend this article:

https://info.sapien.com/index.php/guis/ ... i-displays
David
SAPIEN Technologies, Inc.
This topic is 5 years and 2 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked