ListBox speedup - advices ?

Hi,
I am developing a database app and need to show the user the result of the db query which
could sometimes come down to 300 rows and >10 columns.
Xojo built on listbox control is ok but not really smooth and so I am wondering what I can do to
improve scrolling/showing the table AND how can I do this code wise ?

How is it possible to show only the visible results and hide rows which are not shown ?

What else can you suggest ? I pretty sure some advanced programmes already run into
it but most solutions out are for purchase only so I am not able to learn from a free available code. :frowning:

Limiting the listbox to fewer rows is always going to be the easiest/fastest option. List boxes aren’t really meant for a lot rows. We try to limit to about a hundred at a time and use ‘Paging’ using the SQL Limit and Offset commands.

The UI and logic isn’t very hard to do. We did an hour long training video showing how to create it for desktop and web apps a few months ago.

If you insist on that many rows, you might want to look at Einhugur’s DataGrid control or StyleGrid control. The problem is that you can’t mix and match the Einhugur grids and the Listbox control since they look slightly different.

Hi Bob,

It’s not really required to show more than 50 rows.

Limiting the rows is clear but I really don’t know how handling the data and put it into the right column when the user scrolls up and down. Einhuhur is fast but looks different and not for free.

Rob, is this on OSX or Windows?

OSX

[quote=159192:@Rob Egal]Hi Bob,

It’s not really required to show more than 50 rows.

Limiting the rows is clear but I really don’t know how handling the data and put it into the right column when the user scrolls up and down. Einhuhur is fast but looks different and not for free.[/quote]

Can you post a link to the training vid ?[quote=159187:@Bob Keeney]Limiting the listbox to fewer rows is always going to be the easiest/fastest option. List boxes aren’t really meant for a lot rows. We try to limit to about a hundred at a time and use ‘Paging’ using the SQL Limit and Offset commands.

The UI and logic isn’t very hard to do. We did an hour long training video showing how to create it for desktop and web apps a few months ago.

If you insist on that many rows, you might want to look at Einhugur’s DataGrid control or StyleGrid control. The problem is that you can’t mix and match the Einhugur grids and the Listbox control since they look slightly different.[/quote]

Can you post a link to the training vid ?

My remarks concern scrolling, not loading of the ListBox which is faster on the Einhugur Grid and as Bob mentioned paging can do wonders in that area. And the Einhugur grid is faster at loading the data. But as far as scrolling goes…

Two things you need to be aware of regarding scrolling, OSX and Einhugur (which I own as well). I was deeply involved in beta testing out a bug early last year in the ListBox on Cocoa and it did get some redraw optimizations to the Cocoa version. But one thing they could not really do much with was the scrolling, which ends up having to redraw all the visible cells as each new line scrolls into view. On Windows and Carbon it wasn’t much of an issue. On Cocoa, it really slows down when you start getting 10, 15 20+ columns. And the other issue is when I was using the Einhugur grid in this particular situation I ran into several display quirks / bugs with the Einhugur Grid on Cocoa. I ended up talking to them at length and they said a rewrite is going to be needed to get all the bugs out under Cocoa. If you are building for Cocoa (likely) you need to keep this in mind. As much as a love the Einhugur grid, I had to rip it out of this particular application and go back to the ListBox. My only other option was to scale back some of the cell formatting I was doing.

You might also try Kem’s Data On Demand ListBox.

This may be a bit old school but perhaps they really don’t all the time if it was recoded.

The pixels for rows that are already on screen don’t need to be redrawn… just moved (which can be VERY fast). Only new rows that are first scrolling into view need to drawn from scratch… no?

  • karen

My test routine showed that each visible cell was dirtied when a new line was scrolled into view. That was about all they could do at the time and I was very happy with what they had done, getting InvalidateCell(myRow, MyCol) to work properly on Cocoa. It is tolerable now, before it wasn’t.

You don’t load the data when the user scrolls up and down, you only show a Page of data at at time. This is how most websites work. They have a listbox that can show 50 rows at a time and they usually have a widget that allows you to Go to First/Last/Next/Previous pages.

Seems like you have $ constraints. Our training videos are for subscribers (though we have about 8 hours that are free). Currently we have over 60 hours of video at http://xojo.bkeeney.com/XojoTraining/. That particular video is at http://www.bkeeney.com/XojoTraining/xojotraining.cgi?video=338

When I first started programming with Xojo, I felt a bit lost, so I bought the subscription to the bkenney videos. Well worth the money in my opinion, just about everything is covered and really got me over the hump. I recommend them highly.

Thanks, Merv!

I am glad someone else asked this question, because I was actually having trouble going to sleep last night wondering how I was going to tackle large list selectors for a project I am considering. Several fields will require validation against large product, location, and ZIP code lists, and the user will need the flexibility to enter data manually if they happen to know it, or lookup the data with search on either a code or description against a large list.

I just purchased the training videos from @Bob Keeney a few minutes ago, so I can’t wait to check out this one in particular. Bob, give me access quick!

Hi Bob
In the Page Data Video do you show how to search on the same listbox

Sort of. I’m not using a SearchField but I am filtering by an Age Range. It wouldn’t be too hard to add one. And, FWIW, I’m not searching the listbox, I change the query behind the database. Searching the listbox is kind of pointless when paging data.

Slow listbox in OSX? I reported this bug a while back - I think it’s not been fixed yet:
feedback://showreport?report_id=26903

Workaround : disable the FocusRing.

If anyone notices this is still a problem in 2014 R3.2 - please update the feedback case.

[quote=159675:@Michael Diehr]Slow listbox in OSX? I reported this bug a while back - I think it’s not been fixed yet:
feedback://showreport?report_id=26903

Workaround : disable the FocusRing.

If anyone notices this is still a problem in 2014 R3.2 - please update the feedback case.[/quote]

If it was fixed, it would appear as such. It looks all but forgotten.

Usually, but on occasion, bugs are accidentally fixed as a side-effect of another fix, so it’s always worth verifying they still exist in the newest versions.

From Joe’s comment that refresh is 2 to 10x slower when focus ring is displayed, it looks intrinsic to Cocoa.