FMX.CustomPicker Sample

From RAD Studio Code Examples
Jump to: navigation, search

This sample demonstrates how to use the TComboBox component to customize and invoke an item picker.

Location

You can find the CustomPicker sample project at:

  • Start | Programs | Embarcadero RAD Studio Alexandria | Samples and then navigate to:
    • Object Pascal\Mobile Snippets\CustomPicker
    • CPP\Mobile Snippets\CustomPicker
  • 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.

Description

The CustomPicker sample demonstrates how to use an item picker on Android and iOS devices. The sample uses TComboBox to customize the options of the picker and to allow the user to pick an item and display the text of the selected item on a label.

How to Use the Sample

  1. Navigate to one of the locations given above and open:
    • Delphi: CustomPicker.dproj.
    • C++: CustomPicker.cbproj.
  2. Select the target platform, iOS and Android supported.
  3. Press F9 or choose Run > Run.
  4. Interact with the sample:
    • Click or tap the TComboBox control. See how it displays the native picker that allows you to select an item.
    • Select an item.
    • The sample displays the text of the selected item on a label.

Files

File in Delphi File in C++ Contains

CustomPicker.dproj

CustomPicker.cbproj

The project itself.

uMain.fmx

uMain.fmx

The main form where the components are located.

uMain.pas

CustomPickerPCH.h, CustomPicker.cpp

Used to define and implement the sample.

Information.txt

Information.txt

Further information about the sample.

Classes

TCustomPickerForm is the main form that represents the main window of the sample. It contains the following components:

Implementation

When you run the application, there are two TListBoxItems. In the first TListBoxItem, click on the TComboBox next to Pick an Item. Then, the sample displays an item picker that allows you to select one of the four items. When you select an item, an OnChange event displays the text of this item in the second TListBoxItem.

Uses

See Also

Samples