FMX.Mobile.ListViewAddThumbAndCaption Sample (Object Pascal)
This is a project that shows how to customize the appearance of a TListView to show a thumbnail with a caption on the right-hand side of every list view item. It does this by modifying the appearance of the list view at run time.
You can find the ListViewAddThumbAndCaption Sample project at:
- Start | Programs | Appmethod | Samples and then navigate to Object Pascal\Samples\User Interface\ListView
- Subversion Repository: http://sourceforge.net/p/Appmethod/code/HEAD/tree/branches/Appmethod_113/Object%20Pascal/Samples/User%20Interface/ListView
When you run the application, it shows a list view. Each list item shows a thumbnail image with a caption on the right-hand side corner.
You can tap the ToggleEditMode button to have the list view enter a selection edit mode where you can select several items. The buttons at the bottom, LiveBindings and Fill in Code, let you fill the list view with items defined using LiveBindings or defined at run time, respectively.
How to Use the Sample
- Navigate to the location given above and open SampleListViewAddThumbAndCaptionProject.dproj.
- Press F9 or choose Run > Run.
To render the thumbnail and caption on each list view item the application handles the OnUpdateObjects event of the list view. For each list view instance, the application creates and initializes the required TListItemImage instance that will hold the thumbnail and the TListItemText instance that will hold the caption.
When using LiveBindings, the application handles the OnFilledListItem event of the instance of TLinkFillControlToField to fill list view items with the required data for their new fields: the bitmap of the thumbnail and the text of the caption.
You can change at design time the values of the ItemAppearance.ItemAppearance and ItemAppearance.ItemEditAppearance properties of the list view to see how, at run time, the application extends any selected appearance with a thumbnail and a caption on the right-hand side of each item.
- Note: This application is not meant to work with every item appearance, but you can make it work with all of them.
The LiveBindings button uses TLinkFillControlToField to fill the list view using LiveBindings. The Fill in Code button uses a for loop to fill the list view with items created at run time.
- FMX.Mobile.ListViewCustomBottomDetail Sample (Object Pascal)
- FMX.Mobile.ListViewMultiDetailAppearance Sample (Object Pascal)
- FMX.Mobile.ListViewRatingsAppearance Sample (Object Pascal)