This sample illustrates how to add items to a custom list box, using the StyleEditor.
You can find the CustomListBox sample project at:
- Start | Programs | Appmethod 1.16 | Samples and navigate to:
Object Pascal\Multi-Device Samples\User Interface\CustomListBox
CPP\Multi-Device Samples\User Interface\CustomListBox
- Subversion Repository:
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
- Navigate to one of the locations given above and open:
- Object Pascal: CustomListBox.dproj.
- C++: CustomListBox.cbproj.
- Press F9 or choose Run > Run.
FireMonkey Custom List represents the main window of the sample. It contains the following components:
- 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.