The website www.fmxexpress.com has an article with some really detailed information about the ModernListView Library. Lets check what they are saying.

“Developer rzaripov1990 has a custom ListView component over on Github for Firemonkey in Delphi 10 Berlin. The ListView is the central component for every mobile application, and as a developer you should always choose the one that can be heavily customizable and very easy to use/implement. This modern ListView component is available for Delphi 10 Berlin with FireMonkey on Android, IOS, OSX, and Windows”.

What are the features of the ModernListView Library?

One nice feature is that it has both horizontal and vertical mode. Thus, using

ListView.Horizontal := true

enables the list to display the cells (items) in a horizontal perspective, while

ListView.AutoColumns := true   // (default behavior)

displays the items vertically. If you are an artist when designing your look and feel of the application, this component can customize every graphic aspect such with available events such as: SetColorItemSelected, SetColorItemFill, SetColorBackground, SetColorItemSeparator, SetColorText, SetColorTextSelected, SetColorTextDetail, SetColorHeader, SetColorTextHeader, and many other properties.

The properties are self-explanatory, no need to cover them here. With the AutoColumns and ColumnWidth properties, the component will automatically calculate the best fit appearance and position for the items when populating the list (very useful when dealing with large number of items).

Apart form the standard behavior events, you have OnColumnClick listener for the ListView. You also have the option to hide/show the scroll bars (ListView.ShowScrollBar), set indent for items separators (ListView.SeparatorLeftOffset and ListView.SeparatorRightOffset).

How much does the ModernListView Library cost?

The component is free and has some nice demos with it as well. For the moment it is available only for Delphi Berlin using FireMonkey, very useful too if you build multi-device applications.

ModernListView Library IDE screenshot

Using ModernListView Library

Let’s get a better view of what is this all about. We will now go through some of the components, their design and what they do.

ModernListView Library colorizer screenshot

Colorizer

  • ListView1.SetColorItemSelected(TAlphaColorRec.Orangered);
  • ListView1.SetColorItemFill(TAlphaColorRec.Whitesmoke);
  • ListView1.SetColorItemFillAlt(TAlphaColorRec.Lightgrey);
  • ListView1.SetColorBackground(TAlphaColorRec.Whitesmoke);
  • ListView1.SetColorItemSeparator(TAlphaColorRec.Red);
  • ListView1.SetColorText(TAlphaColorRec.Darkmagenta);
  • ListView1.SetColorTextSelected(TAlphaColorRec.Blueviolet);
  • ListView1.SetColorTextDetail(TAlphaColorRec.Darksalmon);
  • ListView1.SetColorHeader(TAlphaColorRec.Crimson);
  • ListView1.SetColorTextHeader(TAlphaColorRec.Whitesmoke);
  • ListView1.SetColorTextHeaderShadow(TAlphaColorRec.grey);
  • ListView1.SetColorPullRefresh(TAlphaColorRec.Lime);
  • ListView1.SetColorPullRefreshIndicator(TAlphaColorRec.Limegreen);
  • ListView1.SetColorStretchGlow(TAlphaColorRec.Limegreen);
set custom color for item
if ListView1.IsCustomColorUsed(ListView1.ItemIndex) then
    ListView1.SetDefaultColorForItem(ListView1.ItemIndex)
  else
    ListView1.SetCustomColorForItem(ListView1.ItemIndex, TAlphaColorF.Create(random(255) / 255, random(255) / 255, random(255) / 255, random(255) / 255).ToAlphaColor);

Horizontal Mode

ModernListView Library alignment modes screenshot
  • ListView1.Horizontal := true;

Columns Mode (only vertical)

ModernListView Library columns mode
  • ListView1.ColumnWidth := 160;
  • ListView1.AutoColumns := true;

Events

event for AutoColumn mode

procedure OnColumnClick(const Column: Integer; const X, Y: Single; const AItem: TListViewItem; const DrawebleName: string);

called when end of list

procedure OnScrollEnd(Sender: TObject);

Methods

  • Style for ListView Columns Mode
  • ListView1.ShowScrollBar – hide/show scrollbar
  • ListView1.ItemsClearTrue – correct delete items
  • ListView1.OffsetTop – indent of the first element
  • ListView1.OffsetBottom – indent of the last element
  • ListView1.getFirstVisibleItemIndex – first visible ItemIndex
  • ListView1.getVisibleCount – amount of visible items
  • ListView1.getLastVisibleItemindex – first visible ItemIndex + amount of visible items
  • ListView1.SeparatorLeftOffset – indent for separator line
  • ListView1.SeparatorRightOffset – indent for separator line
  • ListView1.EnableTouchAnimation – enable/disable touch animation

The list is long, so if you want to see all of it and try the library, just go to Github, download and test this package: https://github.com/rzaripov1990/ModernListView

Note that the screen shots and some of the text in this article are drawn from the above GitHub repository.