# ListBox speedup - advices ?

**URL:** <https://forum.xojo.com/t/listbox-speedup-advices/21569>\
**Category:** General\
**Created:** [January 13, 2015, 9:14pm UTC](https://forum.xojo.com/t/listbox-speedup-advices/21569 "2015-01-13T21:14:39Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rob\_Egal](https://forum.xojo.com/letter_avatar_proxy/v4/letter/r/76d3ee/32.png) [@Rob\_Egal](https://forum.xojo.com/u/Rob_Egal)\
**Post date:** [January 13, 2015, 9:14pm UTC](https://forum.xojo.com/t/listbox-speedup-advices/21569/1 "2015-01-13T21:14:39Z")

</div>

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. ☹

---

<div class="post-metadata">

**Author:** ![Bob\_Keeney](https://forum.xojo.com/letter_avatar_proxy/v4/letter/b/54ee81/32.png) [@Bob\_Keeney](https://forum.xojo.com/u/Bob_Keeney)\
**Post date:** [January 13, 2015, 9:22pm UTC](https://forum.xojo.com/t/listbox-speedup-advices/21569/2 "2015-01-13T21:22:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Rob\_Egal](https://forum.xojo.com/letter_avatar_proxy/v4/letter/r/76d3ee/32.png) [@Rob\_Egal](https://forum.xojo.com/u/Rob_Egal)\
**Post date:** [January 13, 2015, 9:31pm UTC](https://forum.xojo.com/t/listbox-speedup-advices/21569/3 "2015-01-13T21:31:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Merv\_Pate](https://forum.xojo.com/letter_avatar_proxy/v4/letter/m/76d3ee/32.png) [@Merv\_Pate](https://forum.xojo.com/u/Merv_Pate)\
**Post date:** [January 13, 2015, 9:31pm UTC](https://forum.xojo.com/t/listbox-speedup-advices/21569/4 "2015-01-13T21:31:45Z")

</div>

Rob, is this on OSX or Windows?

---

<div class="post-metadata">

**Author:** ![Rob\_Egal](https://forum.xojo.com/letter_avatar_proxy/v4/letter/r/76d3ee/32.png) [@Rob\_Egal](https://forum.xojo.com/u/Rob_Egal)\
**Post date:** [January 13, 2015, 9:32pm UTC](https://forum.xojo.com/t/listbox-speedup-advices/21569/5 "2015-01-13T21:32:40Z")

</div>

> [@159194:@Merv Pate](#):
>
> Rob, is this on OSX or Windows?

OSX

---

<div class="post-metadata">

**Author:** ![Rob\_Egal](https://forum.xojo.com/letter_avatar_proxy/v4/letter/r/76d3ee/32.png) [@Rob\_Egal](https://forum.xojo.com/u/Rob_Egal)\
**Post date:** [January 13, 2015, 9:33pm UTC](https://forum.xojo.com/t/listbox-speedup-advices/21569/6 "2015-01-13T21:33:49Z")

</div>

[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 ?

---

<div class="post-metadata">

**Author:** ![Merv\_Pate](https://forum.xojo.com/letter_avatar_proxy/v4/letter/m/76d3ee/32.png) [@Merv\_Pate](https://forum.xojo.com/u/Merv_Pate)\
**Post date:** [January 13, 2015, 9:45pm UTC](https://forum.xojo.com/t/listbox-speedup-advices/21569/7 "2015-01-13T21:45:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Paul\_Lefebvre](https://forum.xojo.com/user_avatar/forum.xojo.com/paul_lefebvre/32/3152_2.png) [@Paul\_Lefebvre](https://forum.xojo.com/u/Paul_Lefebvre)\
**Post date:** [January 13, 2015, 10:04pm UTC](https://forum.xojo.com/t/listbox-speedup-advices/21569/8 "2015-01-13T22:04:02Z")

</div>

You might also try Kem’s [Data On Demand ListBox](http://www.mactechnologies.com/index.php?page=downloads#dod).

---

<div class="post-metadata">

**Author:** ![KarenA](https://forum.xojo.com/letter_avatar_proxy/v4/letter/k/c89c15/32.png) [@KarenA](https://forum.xojo.com/u/KarenA)\
**Post date:** [January 13, 2015, 10:22pm UTC](https://forum.xojo.com/t/listbox-speedup-advices/21569/9 "2015-01-13T22:22:18Z")

</div>

> [@159203:@Merv Pate](#):
>
> 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.

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

---

<div class="post-metadata">

**Author:** ![Merv\_Pate](https://forum.xojo.com/letter_avatar_proxy/v4/letter/m/76d3ee/32.png) [@Merv\_Pate](https://forum.xojo.com/u/Merv_Pate)\
**Post date:** [January 13, 2015, 10:29pm UTC](https://forum.xojo.com/t/listbox-speedup-advices/21569/10 "2015-01-13T22:29:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Bob\_Keeney](https://forum.xojo.com/letter_avatar_proxy/v4/letter/b/54ee81/32.png) [@Bob\_Keeney](https://forum.xojo.com/u/Bob_Keeney)\
**Post date:** [January 13, 2015, 11:24pm UTC](https://forum.xojo.com/t/listbox-speedup-advices/21569/11 "2015-01-13T23:24:32Z")

</div>

> [@159192:@Rob Egal](#):
>
> 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.

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/](http://xojo.bkeeney.com/XojoTraining/). That particular video is at [http://www.bkeeney.com/XojoTraining/xojotraining.cgi?video=338](http://www.bkeeney.com/XojoTraining/xojotraining.cgi?video=338)

---

<div class="post-metadata">

**Author:** ![Merv\_Pate](https://forum.xojo.com/letter_avatar_proxy/v4/letter/m/76d3ee/32.png) [@Merv\_Pate](https://forum.xojo.com/u/Merv_Pate)\
**Post date:** [January 13, 2015, 11:29pm UTC](https://forum.xojo.com/t/listbox-speedup-advices/21569/12 "2015-01-13T23:29:51Z")

</div>

> [@159240:@Bob Keeney](#):
>
> Our training videos are for subscribers

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.

---

<div class="post-metadata">

**Author:** ![Bob\_Keeney](https://forum.xojo.com/letter_avatar_proxy/v4/letter/b/54ee81/32.png) [@Bob\_Keeney](https://forum.xojo.com/u/Bob_Keeney)\
**Post date:** [January 13, 2015, 11:33pm UTC](https://forum.xojo.com/t/listbox-speedup-advices/21569/13 "2015-01-13T23:33:56Z")

</div>

> [@159241:@Merv Pate](#):
>
> I recommend them highly.

Thanks, Merv!

---

<div class="post-metadata">

**Author:** ![Mark\_Myers](https://forum.xojo.com/letter_avatar_proxy/v4/letter/m/df788c/32.png) [@Mark\_Myers](https://forum.xojo.com/u/Mark_Myers)\
**Post date:** [January 13, 2015, 11:43pm UTC](https://forum.xojo.com/t/listbox-speedup-advices/21569/14 "2015-01-13T23:43:13Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Alexis\_Colon\_Lugo](https://forum.xojo.com/user_avatar/forum.xojo.com/alexis_colon_lugo/32/572_2.png) [@Alexis\_Colon\_Lugo](https://forum.xojo.com/u/Alexis_Colon_Lugo)\
**Post date:** [January 14, 2015, 1:54am UTC](https://forum.xojo.com/t/listbox-speedup-advices/21569/15 "2015-01-14T01:54:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Bob\_Keeney](https://forum.xojo.com/letter_avatar_proxy/v4/letter/b/54ee81/32.png) [@Bob\_Keeney](https://forum.xojo.com/u/Bob_Keeney)\
**Post date:** [January 14, 2015, 3:37am UTC](https://forum.xojo.com/t/listbox-speedup-advices/21569/16 "2015-01-14T03:37:22Z")

</div>

> [@159265:@Alexis Colon Lugo](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![Mike\_D](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_d/32/266_2.png) [@Mike\_D](https://forum.xojo.com/u/Mike_D)\
**Post date:** [January 15, 2015, 5:38pm UTC](https://forum.xojo.com/t/listbox-speedup-advices/21569/17 "2015-01-15T17:38:45Z")

</div>

Slow listbox in OSX? I reported this bug a while back - I think it’s not been fixed yet:  
\<[https://xojo.com/issue/26903](https://xojo.com/issue/26903)\>

Workaround : disable the FocusRing.

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

---

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [January 16, 2015, 1:47pm UTC](https://forum.xojo.com/t/listbox-speedup-advices/21569/18 "2015-01-16T13:47:28Z")

</div>

[quote=159675:@Michael Diehr]Slow listbox in OSX? I reported this bug a while back - I think it’s not been fixed yet:  
\<[https://xojo.com/issue/26903](https://xojo.com/issue/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.

---

<div class="post-metadata">

**Author:** ![Mike\_D](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_d/32/266_2.png) [@Mike\_D](https://forum.xojo.com/u/Mike_D)\
**Post date:** [January 16, 2015, 3:26pm UTC](https://forum.xojo.com/t/listbox-speedup-advices/21569/19 "2015-01-16T15:26:20Z")

</div>

> [@159881:@Michel Bujardet](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [January 16, 2015, 8:21pm UTC](https://forum.xojo.com/t/listbox-speedup-advices/21569/20 "2015-01-16T20:21:03Z")

</div>

> [@159900:@Michael Diehr](#):
>
> 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.

[Next page](https://forum.xojo.com/t/listbox-speedup-advices/21569.md?page=2)
