0

Windows 10, Delphi 10.2 Tokyo, Firemonkey framework.

I drop a TCombobox on the form, populate it with 20000 items (takes 5 seconds), then when I click the arrow of the combobox for the dropdown to appear, it takes 15 seconds to do so. The VCL TComboBox does this instantly for me.

Is there anything I can do to speed up this behavior? Why does it take that long?

  • 6
    20000 is an enormous amount of items in your combobox. I'm not surprised that a phone has trouble handling that. You may have to re-think the design of your GUI. – S.L. Barth is on codidact.com Apr 05 '17 at 13:46
  • 4
    I second this... no user is going to be happy having to select from a list of 20K items. That's not what combo boxes are for. Maybe a TListView with a search box would be better. – Frazz Apr 05 '17 at 13:56
  • Its not running on a phone, its Desktop only, Win32/Win64 and Mac OSX. My VCL version has no issue, no delays, is fast. –  Apr 05 '17 at 14:54
  • A `TComboBox` is the wrong thing for this task. As mentioned, no user will appreciate this interface. Use a list view with search instead. – Jerry Dodge Apr 05 '17 at 14:58
  • 2
    That's down to the design of FMX. It is very heavy weight. Each item is an object! Really you need some sort of virtual control. Don't know if the FMX controls offer that capability since I am allergic to FMX. – David Heffernan Apr 05 '17 at 15:55
  • @David Actually, that's true for `TListBox` and `TListView`, but not `TComboBox` in FMX. A Firemonkey combo box uses a `TStrings`, just like in VCL. `ComboBox1.Items.Append('One'); ComboBox1.Items.Append('Two'); ComboBox1.Items.Append('Three'); ShowMessage(IntToStr(ComboBox1.ControlsCount));` shows a result of `1`. – Jerry Dodge Apr 05 '17 at 16:10
  • Oh, that *dondu dat* off-topic choir... Combobox of `CBS_SIMPLE` style with thousands items perfectly fits both usability and performance constraints. Yet OP should start using profiler to find out the answer **why**. – Free Consulting Apr 05 '17 at 17:10
  • @FreeConsulting OP is using Firemonkey on OS-X. `CBS_SIMPLE` is a Windows thing. – Jerry Dodge Apr 05 '17 at 17:13
  • If im not mistaken the drop down list of the `FMX TComboBox` is really an `FMX TListBox` which is "documented" as beign slow for thousands of items – Agustin Ortu Apr 05 '17 at 21:01
  • 1
    @AgustinOrtu It appears you're right. I was thrown off by the fact that the Object Inspector has just an `Items` property which is of type `TStrings`, and nothing related to list items. But right-clicking on the control and going to `Items Editor...` shows the same as the `TListBox` item editor. – Jerry Dodge Apr 05 '17 at 22:15
  • @Softtouch With this information, since the `TComboBox` actually uses a `TListBox`, you should be fully aware of the reason why people avoid the `TListBox` for many items: http://stackoverflow.com/questions/29339179/create-a-customized-item-appearance-for-listview-delphi-xe7/31504499#31504499 – Jerry Dodge Apr 05 '17 at 22:17
  • 1
    I see, thank you. I was hoping I could use the combobox just like I do in the original vcl application, where the combobox holds a list of citys with zip codes, and user can type the name into the combobox and the autocomplete select automatically the correct city. I guess I will have to do this then somehow using a listview or 3rd. party component. –  Apr 06 '17 at 00:28
  • So there is then no control which can behave like a combobox? Even webcontrols have no problem with a list of 20000 strings. How come there is nothing in firemonkey? –  Oct 12 '17 at 09:24

0 Answers0