FMX.ListCollections Sample

From RAD Studio Code Examples
Jump to: navigation, search

This sample illustrates how to use LiveBindings to populate a list box with the items gathered from various collections, using a TBindList type of LiveBinding.

Note: Instructions for constructing this sample are given in Tutorial: Creating Collection Lists Using LiveBindings.

Location

You can find the SurfSpotFinderApp sample project at:

  • Start | Programs | Embarcadero RAD Studio Sydney | Samples and navigate to:
    • Object Pascal\Multi-Device Samples\User Interface\ListCollections
  • Subversion Repository:
    • You can find Delphi code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version.

Description

The sample application uses several visual objects that are bound via TBindList to the list box. A combo box holds a series of items describing various collections you can choose from when populating the list box.

The Control Component and Control Expression fields are not editable and they specify the control component (ListBox1) and the control expression.

The Source Component field is also not editable and it specifies the source component, which varies each time you select another collection type from the combo box.

The Source Expression field is editable and allows typing in the binding expression used to gather information from the source component. This binding expression also supports conversion methods such as ToStr to convert from numbers to strings.

Each time you press the Fill button (or Auto Fill is selected), the list box is populated with 100 items, generated at run time, for the collection specified through the Collection combo box.

How to Use the Sample

  1. Navigate to the location given above, and open ListCollectionsSampleProject.dproj.
  2. Press F9 or choose Run > Run.

Classes

List Collections Demo represents the main window of the sample. It contains the following components:

Implementation

  • The SampleCollections.pas unit implements the additional supported collections of elements that will be exported to the List Box by means of LiveBindings.

Uses

See Also