Horizontal Scolling in Listbox – Performance?


I am writing an application that contains a listbox, which is being populated with data from an SQLite database. Everything works as it should and all functions are processed in an instant – except from horizontal scrolling in the listbox, which is quite CPU heavy and doesn’t run as smoothly as I had expected. At first I thought it might be too much work done by the CellBackgroundPaint event, but even if I remove this event completely, horizontal scrolling is still somewhat sluggish.
Is this a common problem, or did I do something wrong elsewhere I don’t know of?

how many columns are you talking here?
is the data in those columns dynamically populated as you scroll?
or is the data already loaded? If already loaded, how many rows as well.
Listbox is not meant to view hundreds (or dozens) of columns, and thousands of rows

The only time I experienced a similar behavior was when I by mistake had a column show the contents of a blob field. Everything was running smoothly until I scrolled to include that column. Do you have a field that contains way too much content to fit into the cell?

The listbox shows students in a class and their grades during a term, so there are 25 to 35 rows and up to 30 to 40 columns per row. The data is already loaded when shown in the listbox and none is too big for its cell.

By now I noticed there was something wrong with my algorithm for populating the cells, which is fixed by now. The scrolling feels not/hardly sluggish anymore. But still there is up to 50% CPU load while continuous scrolling through the listbox, which I find a lot for so little data…

@Dave: What would you suggest instead of a listbox for showing and editing larger amounts of data?

Have a look at http://www.pidog.com/piDogScrollingCanvas/DataView.shtml . It’s not cheap but it’s good. If you only need MacOS then check out the very latest beta of the MBS plugin.

Thanks for the suggestion, but I am just a hobby programmer without the intention of making money with my applications. And while spending the money for the Xojo licence was worth it for me, any additional costs will be too much for just coding around. So I think I will stick to the listbox for the moment and see how far I can get with it. :slight_smile:

Perhaps separate the data a little more?

From a usage standpoint, would the user ever need that much data on the student scores all at once?
Are they comparing Bobby’s third test to Linda’s fifth? Probably not.

Mayhaps you trim down the ListBox to {Student, Semester 1 Avg, Semester 2 Avg, Year Avg} and a double click on the row pops up a detailed view of the student and their scores in a new window. A ListBox would be great on the detail view because you could just list all the tests taken and their scores as rows.

It’s a common feature of similar applications that you have all grades of one class in the current term at one sight. But your suggestion certainly has its advantages. I will have to think about it a little – at the moment I have just finished the handling of students and I am not fixed to the processing of grades yet.


slow while running in the IDE / stand alone ?

what hardware / OS are you using ?

Hardware: cpu kind/speed, RAM amount at the application running time, is FireFox running concurently (even in the background doing nothing, etc.

Did you try to boot and run only the application (in Plane mode) ?

There was no difference whether the application was running in the IDE or as stand alone.

I am using a MacBook Pro (13" Retina, early 2015, 8 GB RAM). Should be more than enough for the application I am writing – or else I would not want to use it myself.

At the moment I am toying around with Tim’s suggestion and it seems quite promising…

I remember on Mac scrolling Listbox was better with UseFocusRing = False

I had the focus ring already deactivated from the beginning.