# Listbox Very Slow to Load

**URL:** <https://forum.xojo.com/t/listbox-very-slow-to-load/72565>\
**Category:** Web\
**Created:** [October 6, 2022, 6:21pm UTC](https://forum.xojo.com/t/listbox-very-slow-to-load/72565 "2022-10-06T18:21:24Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeffery\_Lemons](https://forum.xojo.com/user_avatar/forum.xojo.com/jeffery_lemons/32/1447_2.png) [@Jeffery\_Lemons](https://forum.xojo.com/u/Jeffery_Lemons)\
**Post date:** [October 6, 2022, 6:21pm UTC](https://forum.xojo.com/t/listbox-very-slow-to-load/72565/1 "2022-10-06T18:21:24Z")

</div>

For the last couple of years since going to Web 2.0 I have been experiencing this. Im looking to figure out how to fix it. The listbox in this video is very simple. It has two columns, the name of the color and the color. The list is a list of web safe colors. It shouldn’t be lagging this bad. Can anyone tell me how to get this listbox to load up correctly in this instance so that it behaves normally? Currently I am just adding row by row and using cell renderer to set the color. Thanks for any help. Here is a photo example.

 ![Screen Shot 2022-10-06 at 12.19.39 PM](https://forum.xojo.com/uploads/default/original/2X/6/6ea23eecb0094d8e697b715ed0f0d6aa7fc393f5.png)

The listbox loads about 10 colors and then just will not load the rest. When you scroll down, there is nothing. A few seconds later, something may pop up but then it disappears when you mouse over it.

---

<div class="post-metadata">

**Author:** ![AlbertoD](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/dbc845/32.png) [@AlbertoD](https://forum.xojo.com/u/AlbertoD)\
**Post date:** [October 6, 2022, 6:52pm UTC](https://forum.xojo.com/t/listbox-very-slow-to-load/72565/2 "2022-10-06T18:52:28Z")

</div>

Can you share a sample?  
Maybe someone can comment looking at the code what to change.

---

<div class="post-metadata">

**Author:** ![Jeffery\_Lemons](https://forum.xojo.com/user_avatar/forum.xojo.com/jeffery_lemons/32/1447_2.png) [@Jeffery\_Lemons](https://forum.xojo.com/u/Jeffery_Lemons)\
**Post date:** [October 6, 2022, 7:18pm UTC](https://forum.xojo.com/t/listbox-very-slow-to-load/72565/3 "2022-10-06T19:18:35Z")

</div>

There really isn’t a lot of code. Here is the open event for the listbox:

```auto
Me.ColumnWidths = "50%, 50%"
Me.HeaderAt(0) = "Color Name"
Me.HeaderAt(1) = "Color"

Me.SetHelpText(TextField_Help, "Click on a color to select it.")

Me.AddRow
Me.CellTextAt(Me.LastAddedRowIndex, 0) = SetStyle_BlankRow("Black")
Me.CellTextAt(Me.LastAddedRowIndex, 1) = SetStyle_CustomColorCell(App.WebColors.Black)
Me.RowTagAt(Me.LastAddedRowIndex) = App.WebColors.Black

Me.AddRow
Me.CellTextAt(Me.LastAddedRowIndex, 0) = SetStyle_BlankRow("Dark Slate Gray")
Me.CellTextAt(Me.LastAddedRowIndex, 1) = SetStyle_CustomColorCell(App.WebColors.DarkSlateGray)
Me.RowTagAt(Me.LastAddedRowIndex) = App.WebColors.DarkSlateGray

```

There are about 100 more of these addrow called to add another row. Here is the code for the method SetStyle\_BlankRow

```auto
Public Function SetStyle_BlankRow(sString as String = "", iVerticalSpace as integer = 2, iHorizontalSpace as integer = 2) As WebListBoxStyleRenderer
  Var style As New WebStyle
  
  style.Value("background-color") = "#fff"
  style.Value("border-width") = ".5px"
  style.Value("border-color") = "#fff"
  style.Value("max-height") = "1px"
  style.Value("padding-left") = str(iHorizontalSpace) + "px"
  style.Value("padding-right") = Str(iHorizontalSpace) + "px"
  style.Value("padding-top") = Str(iVerticalSpace)+ "px"
  style.Value("padding-bottom") = "0px"
  
  Var cellrenderer As New WebListBoxStyleRenderer(style,sString)
  Return cellrenderer
End Function

```

Here is the method for SetStyle\_CustomColorCell

```auto
Public Function SetStyle_CustomColorCell(Color1 as Color) As WebListBoxStyleRenderer
  Var style As New WebStyle
  Var sColor As String = "#" + color1.ToString.Right(6)
  'style.Value("background-color") = "#fff"
  style.Value("background-color") = sColor
  style.Value("border-width") = ".5px"
  style.Value("border-color") = "#fff"
  style.Value("max-height") = "1px"
  style.Value("padding-bottom") = "0px"
  
  Var cellrenderer As New WebListBoxStyleRenderer(style,"")
  Return cellrenderer
End Function

```

The colors are stored in a class for the app. It’s a pretty simple setup but the listbox does not load fully.

---

<div class="post-metadata">

**Author:** ![Ivan\_Tellez](https://forum.xojo.com/letter_avatar_proxy/v4/letter/i/a9a28c/32.png) [@Ivan\_Tellez](https://forum.xojo.com/u/Ivan_Tellez)\
**Post date:** [October 6, 2022, 9:34pm UTC](https://forum.xojo.com/t/listbox-very-slow-to-load/72565/4 "2022-10-06T21:34:16Z")

</div>

> [@Jeffery\_Lemons](#):
>
> Web 2.0 I have been experiencing this. Im looking to figure out how to fix it.

Web 2 is far from stable now, why would you use it 2 years ago? 😱

> [@Jeffery\_Lemons](#):
>
> Can anyone tell me how to get this listbox to load up correctly in this instance so that it behaves normally?

Im sure there is a hack somewere to make it work but the WebList sucks, dont use it.

**The work around:**

Create a container with a label and a rectangle, in there add 2 computed properties, “colorname” and “colorcolor”, on the set change the caption of the label and the background color of the rectangle. Add presed event of the label and raise a “colorselected” event

Create a second container, in its openning add dinamically many container1 (this could be really easy with control sets, but xojo decided to not included on web 🙄 so) use EmbedWithin to add the container1 and set the colorname and colorcolor properties, use **AddHandler** to redirect the “colorselected” events of the container1s to a method in second container. Finally, raise another “colorselected” event in second container

---

<div class="post-metadata">

**Author:** ![Jose\_Fernandez\_del\_Valle](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/9de0a6/32.png) [@Jose\_Fernandez\_del\_Valle](https://forum.xojo.com/u/Jose_Fernandez_del_Valle)\
**Post date:** [October 6, 2022, 10:50pm UTC](https://forum.xojo.com/t/listbox-very-slow-to-load/72565/5 "2022-10-06T22:50:51Z")

</div>

In my case, contrary to Ivan, the webListBox object has worked very well for me. I have used it to display 1500 records.

It is much faster than previous versions.

I’ve noticed that what makes this object very slow is adding long content per column. It doesn’t matter if it’s text or image.

For example, I read from the database a field with a long description full of spaces. On the first try, don’t worry about cleaning everything. When trying to load a thousand records, it was slow.

---

<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:** [October 6, 2022, 11:11pm UTC](https://forum.xojo.com/t/listbox-very-slow-to-load/72565/6 "2022-10-06T23:11:15Z")

</div>

Are any of you in the beta testers group? Listbox speed is important and one should test the latest betas, too, if possible…

---

<div class="post-metadata">

**Author:** ![Ivan\_Tellez](https://forum.xojo.com/letter_avatar_proxy/v4/letter/i/a9a28c/32.png) [@Ivan\_Tellez](https://forum.xojo.com/u/Ivan_Tellez)\
**Post date:** [October 6, 2022, 11:53pm UTC](https://forum.xojo.com/t/listbox-very-slow-to-load/72565/7 "2022-10-06T23:53:10Z")

</div>

> [@Mike\_D](#):
>
> Are any of you in the beta testers group?

Web2 still has many bugs for me to use it, I dont have a Current Pro license so I was kicked of the beta tester goup for that.

Beta testers is suposed to be exclusive for those with a current licence. Kind of a vicious circle, lack of testers → more bugs, more bugs → less licences, less licences → lack of testers…

---

<div class="post-metadata">

**Author:** ![Jeffery\_Lemons](https://forum.xojo.com/user_avatar/forum.xojo.com/jeffery_lemons/32/1447_2.png) [@Jeffery\_Lemons](https://forum.xojo.com/u/Jeffery_Lemons)\
**Post date:** [October 7, 2022, 1:35am UTC](https://forum.xojo.com/t/listbox-very-slow-to-load/72565/8 "2022-10-07T01:35:15Z")

</div>

I am working on the latest beta 58134.

---

<div class="post-metadata">

**Author:** ![Jean-Yves\_Pochez](https://forum.xojo.com/user_avatar/forum.xojo.com/jean-yves_pochez/32/21769_2.png) [@Jean-Yves\_Pochez](https://forum.xojo.com/u/Jean-Yves_Pochez)\
**Post date:** [October 7, 2022, 6:50am UTC](https://forum.xojo.com/t/listbox-very-slow-to-load/72565/9 "2022-10-07T06:50:30Z")

</div>

> [@Ivan\_Tellez](#):
>
> Web2 still has many bugs for me to use it, I dont have a Current Pro license so I was kicked of the beta tester goup for that.
> 
> Beta testers is suposed to be exclusive for those with a current licence. Kind of a vicious circle, lack of testers → more bugs, more bugs → less licences, less licences → lack of testers…

today, you don’t need to have a pro licence anymore to be beta tester. you just ask xojo team to be part of the beta tester group.

---

<div class="post-metadata">

**Author:** ![Tim\_Hare](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_hare/32/176_2.png) [@Tim\_Hare](https://forum.xojo.com/u/Tim_Hare)\
**Post date:** [October 7, 2022, 7:46am UTC](https://forum.xojo.com/t/listbox-very-slow-to-load/72565/10 "2022-10-07T07:46:13Z")

</div>

I think you still need a current license, pro or not.

---

<div class="post-metadata">

**Author:** ![Maximilian\_Tyrtania](https://forum.xojo.com/user_avatar/forum.xojo.com/maximilian_tyrtania/32/294_2.png) [@Maximilian\_Tyrtania](https://forum.xojo.com/u/Maximilian_Tyrtania)\
**Post date:** [October 7, 2022, 8:26am UTC](https://forum.xojo.com/t/listbox-very-slow-to-load/72565/11 "2022-10-07T08:26:05Z")

</div>

I notice that you are recreating your webstyles once per row, which is inefficient, you should create them once only and then store and reuse them. Not sure if that makes a bit difference though.

---

<div class="post-metadata">

**Author:** ![Rick\_Araujo](https://forum.xojo.com/user_avatar/forum.xojo.com/rick_araujo/32/251_2.png) [@Rick\_Araujo](https://forum.xojo.com/u/Rick_Araujo)\
**Post date:** [October 7, 2022, 11:48am UTC](https://forum.xojo.com/t/listbox-very-slow-to-load/72565/12 "2022-10-07T11:48:38Z")

</div>

👍🏻

> [@Maximilian\_Tyrtania](#):
>
> Not sure if that makes a bit difference though

It should add some overhead code, so it adds some weight that could be avoided.

---

<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:** [October 7, 2022, 2:20pm UTC](https://forum.xojo.com/t/listbox-very-slow-to-load/72565/13 "2022-10-07T14:20:11Z")

</div>

> [@Jeffery\_Lemons](#):
>
> I am working on the latest beta 58134.

Should be discussed in the beta forum then: [https://forum.xojo.com/t/weblistbox-loading-speed-in-2022r3/72583](https://forum.xojo.com/t/weblistbox-loading-speed-in-2022r3/72583)

---

<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:** [October 7, 2022, 2:21pm UTC](https://forum.xojo.com/t/listbox-very-slow-to-load/72565/14 "2022-10-07T14:21:41Z")

</div>

> [@Ivan\_Tellez](#):
>
> I was kicked of the beta tester goup for that.

You can still apply to the testers group, even without the Pro license.

See [Welcoming more pre-release testers](https://forum.xojo.com/t/welcoming-more-pre-release-testers/35674)

---

<div class="post-metadata">

**Author:** ![Ricardo\_Cruz](https://forum.xojo.com/user_avatar/forum.xojo.com/ricardo_cruz/32/7852_2.png) [@Ricardo\_Cruz](https://forum.xojo.com/u/Ricardo_Cruz)\
**Post date:** [October 10, 2022, 9:13am UTC](https://forum.xojo.com/t/listbox-very-slow-to-load/72565/15 "2022-10-10T09:13:43Z")

</div>

It looks like there is a bug in the R3 beta happening when assigning a cell renderer. We’ll prepare a fix, sorry about that.

---

<div class="post-metadata">

**Author:** ![Ricardo\_Cruz](https://forum.xojo.com/user_avatar/forum.xojo.com/ricardo_cruz/32/7852_2.png) [@Ricardo\_Cruz](https://forum.xojo.com/u/Ricardo_Cruz)\
**Post date:** [October 10, 2022, 2:27pm UTC](https://forum.xojo.com/t/listbox-very-slow-to-load/72565/16 "2022-10-10T14:27:44Z")

</div>

@Jeffery_Lemons we’ve been fixing one beta issue that was causing the WebListBox to take longer than usual to load. But if this is only affecting R3, can you please open an [Issue](https://tracker.xojo.com/xojoinc/xojo/-/issues) to ensure it gets fixed urgently?

Thank you

---

<div class="post-metadata">

**Author:** ![Jeffery\_Lemons](https://forum.xojo.com/user_avatar/forum.xojo.com/jeffery_lemons/32/1447_2.png) [@Jeffery\_Lemons](https://forum.xojo.com/u/Jeffery_Lemons)\
**Post date:** [October 10, 2022, 6:04pm UTC](https://forum.xojo.com/t/listbox-very-slow-to-load/72565/17 "2022-10-10T18:04:12Z")

</div>

Yes I will do that.
