Using a styled TListView to handle a long list of data
The TListBox
control is very flexible. You can customize every aspect of each item in the list. However, it is not suitable if you want to handle a long list of data because flexibility comes at the cost of the system being slow when the number of data rows grow. Embarcadero specifies that you should use TListView
to display a collection of items in a list that is optimized for LiveBindings and for fast and smooth scrolling.
Getting ready
In this recipe, we will use the Do not block main thread! recipe as a base to customize a list view using custom styles. In that recipe, we get a list of weather forecasts from a REST web service and then fill in the list view with that data using a standard style. In this recipe, that data will be nicely inserted into a custom list view with colors, alignment, and a summary footer. There is no design-time support with this approach because all the controls created in each item are created at runtime...