FMX.SearchContext Sample

From RAD Studio Code Examples
Jump to: navigation, search

This sample demonstrates how to create and use a search context, and how to use FireMonkey image effects.


You can find the SearchContext sample project at:

  • Start | Programs | Embarcadero RAD Studio Athens | Samples and navigate to:
    • Object Pascal\Multi-Device Samples\User Interface\SearchContext
    • CPP\Multi-Device Samples\User Interface\SearchContext
  • 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.


By modifying a TClearingEdit, a field with its associated icons will be highlighted through its opacity and glow effects. It also uses a menu with options for loading data, managing data, and uploading new images using Live Bindings.

Select Options > Manage Data to configure the search options. You may also double click the icon image to add more icons.

How to Use the Sample

  1. To run the example, open its project file:
    • Delphi: SearchContext.dproj
    • C++: SearchContext_Cpp.cbproj
  2. Press F9 or choose Run > Run.
  3. Start typing a search term that matches the beginning of one of the "INTERNET" or "SYSTEM" items, to see it highlighted.
Note: If you want to deploy this sample application, first you must:
  1. Add to the Deployment Manager the iconData.cds file for any target platform.
  2. Add the MIDAS library to the Deployment Manager as well for any target platform.


File Class
unitSearchMenuHelperCpp The TSearchItem class, the TSearchBand class, the TSearchBandManager class
  • Delphi: The TfrmManageData class.
  • C++: The TfrmData class.
dataData The TdtmdlData Class
formMain the TfrmMain Class

SearchContext (Delphi)
SearchContext_Cpp (C++)

The project itself



When you run the application, the main window of the sample is displayed:

  • Select the Options > Load Data command to load the data. This also happens by default at the form creation.
  • Select the Options > Load Images command to open a browse dialog, where you can select and open a new cdsIconData, after closing the former one.
  • Select the Options > Manage Data command to open a TForm, where using TBindNavigator you can add, delete, and navigate through items.
  • Search for a word and observe the TGlowEffect and Opacity change around the icons where the text matches either the label or one of its associated search terms. There can be no glow, partial glow (when a part of the word coresponds), and full glow.
  • Double-click on an icon to display its corresponding list of search terms.