The Sample is using the “Custom” list view item appearance value and configuring the appearance properties of list view items at design time. It also shows how to do this at run time.
When you run the application, it shows a list view. Each list item shows a detail text under its main label.
Tap the Set Properties button to change the appearance of the list view at run time. 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.
You can find the ListViewCustomBottomDetail Sample sample project at:
- Start | Programs | Embarcadero RAD Studio Sydney | Samples and navigate to:
Object PascalMulti-Device SamplesUser InterfaceListViewListViewCustomBottomDetail
CPPMulti-Device SamplesUser InterfaceListViewListViewCustomBottomDetail
- Subversion Repository:
- You can find Delphi and C++ code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version.
How to Use the Sample
- Navigate to the one of the locations given above, and open:
- Delphi: SampleListViewCustomBottomDetailProject.dproj
- C++: SampleListViewCustomBottomDetailProject.cbproj
- Press F9 or choose Run > Run.
The values of the ItemAppearance.ItemAppearance and ItemAppearance.ItemEditAppearance properties of the list view in this application are “Custom”. This indicates that, instead of using a default appearance set, the appearance objects of the item appearance are customized. They have been customized at design time, selecting appearance objects in the Structure view and changing their properties from the Object Inspector.
By default, the base custom appearance only has one visible appearance object: Text. That is, Text is the only visible appearance object in TListView.ItemAppearance.Item and TListView.ItemAppearance.ItemEdit. This application makes visible the following appearance objects as well, and configures their properties to customize their appearance:
In addition to these design time changes, this application handles the OnUpdateObjects event of the list view to adjust the width of the Text and Detail appearance objects.
The Set Properties button, when tapped, modifies the appearance of the list view at run time, performing appearance adjustment on top of the custom appearance defined at design time.
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.
You can follow the link below which will guide you to the original post of the Sample:
Head over and check out the full source code for customizing the listview detail of a listitem in Delphi.
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition