FMX.CustomListBox Sample

From Appmethod Code Examples
Jump to: navigation, search

This sample illustrates how to add items to a custom list box, using the StyleEditor.

Location

You can find the CustomListBox sample project at:

Description

This application uses a list box and populates the list with custom items that contain information about an image file (thumbnail, name, resolution, depth, and so on). The items are created using a custom style, set in the TStyleBook editor. The project uses the binding features to set the values of or get the values from the items and set the event handlers.

How to Use the Sample

  1. Navigate to one of the locations given above and open:
    • Object Pascal: CustomListBox.dproj.
    • C++: CustomListBox.cbproj.
  2. Press F9 or choose Run > Run.

Classes

FireMonkey Custom List represents the main window of the sample. It contains the following components:

Implementation

  • The ListBox is populated with customized items that contain information about an image, when the user presses one of the buttons. The Add By Code button adds one item. The Add 1000 By Code button adds 1000 new random items. The user can add other images by clicking the Add From File... button, which opens the TOpenDialog object, allowing the user to find the desired image on the computer.
  • The items contain a thumbnail, information about the image, and a button labeled info. When clicking the info button, a text appears on the info label as a result of the OnClick event trigger.
  • The customized items use the StylesData property to set the values for the children controls.

Uses

See Also

Personal tools