TTMSFNCFilterView
Overview
The TMSFNCFilterView unit provides visual components for building and managing filter interfaces in TMS FNC applications.
It offers customizable filter controls including checkboxes, radio buttons, trackbars, and range sliders that can be connected to a TTMSFNCFilterStructure to create interactive filter UIs.
These controls can be added via the Context Menu in Design-Time or programmatically.

TTMSFNCFilterView
TTMSFNCFilterView is the main container component that manages the visual layout and organization of filter controls.
It provides automatic layout management, connects to a filter structure, and coordinates the interaction between multiple filter controls.
This component serves as the primary interface for letting users build complex filter via UIs.
Properties
| Property | Description |
|---|---|
| FilterText | Get the current parsed filter text from the Filter Structure. |
| FilterFormatType | Specifies the output format of the filter expressions generated. Options include fftDelphiDataSet, fftUniversalFilterExpressions, fftUniversalFilterExpressions. (Default: fftDelphiDataSet) |
| FilterParseFormat | How the filter expressions are parsed to a filter text, will be set when changing FilterFormatType. |
| UILanguage | The textual representation for different operators that are used in the filter. |
Methods
| Method | Description |
|---|---|
| AddFilterPanel | Adds a specific filter panel top aligned to the Filter View. |
| AddFilterTrackBar | Adds a specific filter trackbar top aligned to the Filter View. |
| AddFilterExpressionValueEdit | Adds a specific filter item, based on a combination of a combobox and edit, top aligned to the Filter View. |
| AddFilterCheckGroup | Adds a specific filter list of checkboxex top aligned to the Filter View. |
| AddFilterRadioGroup | Adds a specific filter list of radiobuttons top aligned to the Filter View. |
| AddFilterCheckBox | Adds a specific filter checkbox top aligned to the Filter View. |
| AddFilterRadioButton | Adds a specific filter radiobutton top aligned to the Filter View. |
| AddFilterRangeSlider | Adds a specific filter range slider top aligned to the Filter View. |
| AddFilterComboBox | Adds a specific filter combobox top aligned to the Filter View. |
| AddFilterDatePicker | Adds a specific filter date picker top aligned to the Filter View. |
| AddText | Adds a HTMLText top aligned to the Filter View. |
| AddFilterControlContainer | Adds a specific filter control that can have any control, top aligned to the Filter View. |
Events
| Event | Description |
|---|---|
| OnFilterTextChanged | Occurs when the filter text has been regenerated due to structure changes. |
| OnFilterTextParse | Occurs before parsing the filter text, allowing cancellation. |
| OnFilterTextParsed | Occurs after filter text is parsed, allowing modification of the final text. |
| OnFilterViewGroupParse | Occurs when parsing a filter group, allowing exclusion from filter text. |
| OnFilterViewGroupParsed | Occurs after a group is parsed, allowing modification of group text. |
| OnFilterViewItemParse | Occurs when parsing a filter item, allowing modification or exclusion. |
Code Example
uses
FMX.TMSFNCFilterView, TMS.TMSFNCFilterBuilder, FMX.TMSFNCRadioButton;
procedure TFilterViewForm.SetupFilterView;
var
fv: TTMSFNCFilterView;
PickUpRadioGroup: TTMSFNCFilterViewRadioGroup;
begin
// Create the filter view
fv := TTMSFNCFilterView.Create(Self);
fv.Parent := Self;
fv.Align := TAlignLayout.Left;
fv.BeginUpdate;
fv.FilterFormatType := fftDelphiDataSet;
// --- Add a checkbox for 'In Stock' ---
fv.AddText('Availability:');
fv.AddFilterCheckBox(False, 'Empty', fdtBoolean, feoEqual, True).Text := 'Available';
// --- Add radio buttons for 'Delivery Option' ---
fv.AddText('Delivery Options:');
PickUpRadioGroup := fv.AddFilterRadioGroup(['Pick-up store', 'TMS Post', 'Fast Transport', 'Pack AG ING'], 0, 'Delivery');
PickUpRadioGroup.FilterExpressions.AddOrUpdateExpression('Pick-up store','',False);
// --- Add a trackbar for 'Rating' ---
fv.AddText('Rating:');
fv.AddFilterTrackBar(0, 0, 5, 'Rating', fdtNumber, feoLargerThanOrEqual);
// --- Add a range slider for 'Price' ---
fv.AddText('Price:');
fv.AddFilterRangeSlider(0, 200, 0, 200, 'Price', fdtNumber);
// --- Show filter changes ---
fv.OnFilterTextChanged := DoFilterTextChanged;
fv.EndUpdate;
FilterLbl.Text := fv.FilterText;
end;
procedure TFilterViewForm.DoFilterTextChanged(Sender: TObject; AFilterText: string);
begin
FilterLbl.Text := AFilterText;
end;
TTMSFNCFilterViewDefaultExpression
TTMSFNCFilterViewDefaultExpression defines default settings for filter expressions. When new expressions are created without explicit parameters, these defaults are applied.
This class helps maintain consistency across filter expressions and reduces repetitive code.
Properties
| Property | Description |
|---|---|
| FilterFieldName | Gets or sets the default field name for filter expressions. This is used when creating new expressions without specifying a property name. |
| FilterFieldType | Gets or sets the default field data type for filter expressions. Options include fdtAutomatic, fdtString, fdtInteger, fdtFloat, fdtDateTime, fdtBoolean. Default is fdtAutomatic. |
| ExpressionOperator | Gets or sets the default expression operator for filter expressions. Options include feoEqual, feoNotEqual, feoGreaterThan, etc. Default is feoNotEmpty. |
TTMSFNCFilterViewExpressions
TTMSFNCFilterViewExpressions is a collection that manages filter expressions and their relationship with filter structure items.
It provides methods to add, update, and remove expressions while automatically maintaining the underlying filter structure.
This collection acts as a bridge between UI controls and the filter logic.
Properties
| Property | Description |
|---|---|
| Items | Provides indexed access to filter view expressions in the collection. Each item is a TTMSFNCFilterViewExpression. |
| FilterItem | Gets the associated filter structure item that is managed by this collection. Read-only. |
| DefaultFilterProperties | Gets or sets the default properties for new expressions. These defaults are applied when creating expressions without explicit parameters. |
Methods
| Method | Description |
|---|---|
| AddFilterItem | Adds a new filter item to the structure based on property value text. Creates or updates the underlying filter structure item. |
| RemoveFilterItem | Removes the current filter item from the structure. Cleans up the connection between expressions and filter structure. |
| UpdateFilterItem | Updates the filter item with new property value. Synchronizes expression changes with the filter structure. |
| AddOrUpdateExpression | Adds a new expression or updates an existing one with specified parameters. Returns the created/updated expression. |
| Add | Adds a new empty expression to the collection. Returns the created expression for further configuration. |
Events
| Event | Description |
|---|---|
| OnChanged | Occurs when the expressions are changed. |
| OnExpressionNotFound | Occurs when an expression is not found for a property value. Allows dynamic expression customization. |
| OnSetFilterItem | Occurs when setting filter item parameters. Allows customization of filter item properties before they're applied. |
TTMSFNCFilterViewExpression
TTMSFNCFilterViewExpression represents a single filter expression in the filter view specific for a value.
It encapsulates the relationship between a UI value (PropertyValue) and the underlying filter parameters.
Each expression can be linked to a value from the UI controls and automatically updates the filter structure when changed.
Properties
| Property | Description |
|---|---|
| FilterFieldName | Gets or sets the property name for this filter expression. This typically corresponds to a database field or object property. |
| FilterFieldType | Gets or sets the data type of the property. Affects how values are parsed and formatted. Default is fdtAutomatic. |
| PropertyValue | Gets or sets the property value as a string. This is typically the display value or identifier shown in UI controls. |
| ExpressionOperator | Gets or sets the comparison operator for this expression. Default is feoEqual. |
| FilterValueText | Gets or sets the value text for the expression. This is parsed according to the FilterFieldType to create the actual filter value. (As this is not available in Desing-Time.) |
| AddToFilter | Gets or sets whether this expression should be added to the filter structure. When False, the expression exists but doesn't affect filtering. Default is True. |
| FilterValue | Gets or sets the actual value as a TTMSFNCValue. This is the parsed result of ValueText based on FilterFieldType. |
Events
| Event | Description |
|---|---|
| OnChanged | Occurs when any property of the expression changes. Use this to respond to expression modifications. |
TTMSFNCFilterViewPanel
You can use the TTMSFNCFilterViewPanel to group different controls in a filter group.
Properties
| Property | Description |
|---|---|
| GroupOperator | Gets or sets the logical operator (AND/OR) to combine the different sub-controls filter expressions. |
Methods
| Method | Description |
|---|---|
| AddFilterPanel | Adds a specific filter panel top aligned to the Filter View. |
| AddFilterTrackBar | Adds a specific filter trackbar top aligned to the Filter View. |
| AddFilterExpressionValueEdit | Adds a specific filter item, based on a combination of a combobox and edit, top aligned to the Filter View. |
| AddFilterCheckGroup | Adds a specific filter list of checkboxex top aligned to the Filter View. |
| AddFilterRadioGroup | Adds a specific filter list of radiobuttons top aligned to the Filter View. |
| AddFilterCheckBox | Adds a specific filter checkbox top aligned to the Filter View. |
| AddFilterRadioButton | Adds a specific filter radiobutton top aligned to the Filter View. |
| AddFilterRangeSlider | Adds a specific filter range slider top aligned to the Filter View. |
| AddFilterComboBox | Adds a specific filter combobox top aligned to the Filter View. |
| AddFilterDatePicker | Adds a specific filter date picker top aligned to the Filter View. |
| AddFilterControlContainer | Adds a specific filter control that can have any control, top aligned to the Filter View. |
| AddText | Adds a HTMLText top aligned to the Filter View. |
TTMSFNCFilterViewCheckGroup
TTMSFNCFilterViewCheckGroup provides a list of checkbox controls for the Filter View.
The control automatically manages the relationship between checkbox state and filter expression.
With the Expressions, you can choose the expression for each item in the Items property. (The PropertyValue can be changed from the checkbox text to the itemindex.)
Properties
Specific to the FilterView, for other events see the TTMSFNCCheckGroup.
| Property | Description |
|----------|-------------|
| DefaultFilterProperties | Gets or sets the default properties for new expressions. These defaults are applied when creating expressions without explicit parameters. |
| FilterExpressions | Collection that manages filter expressions for specific values. |
| GroupOperator | Gets or sets the logical operator (AND/OR) to combine the different checkbox filter expressions. |
| UseCheckBoxTextForPropertyValue | Default True, if set to False the ItemIndex will be used for the Expressions instead of the text of the item. |
Events
Specific to the FilterView, for other events see the TTMSFNCCheckGroup.
| Event | Description |
|-------|-------------|
| OnSetFilterItem | Occurs when setting filter item parameters. Allows customization of filter item properties before they're applied. |
TTMSFNCFilterViewRadioGroup
TTMSFNCFilterViewRadioGroup provides a list of radio button controls for exclusive selection filtering.
With the Expressions, you can choose the expression for each item in the Items property.
Properties
Specific to the FilterView, for other events see the TTMSFNCRadioGroup.
| Property | Description |
|----------|-------------|
| DefaultFilterProperties | Gets or sets the default properties for new expressions. These defaults are applied when creating expressions without explicit parameters. |
| FilterExpressions | Collection that manages filter expressions for specific values. |
| UseRadioTextForPropertyValue | Default True, if set to False the ItemIndex will be used for the Expressions instead of the text of the item. |
Events
Specific to the FilterView, for other events see the TTMSFNCRadioButton.
| Event | Description |
|-------|-------------|
| OnSetFilterItem | Occurs when setting filter item parameters. Allows customization of filter item properties before they're applied. |
Code Example
uses
TMS.TMSFNCFilterBuilder, FMX.TMSFNCUtils;
procedure TFormFilterView.FormCreate(Sender: TObject);
var
filterRadioGroup: TTMSFNCFilterViewRadioGroup;
begin
filterRadioGroup := TTMSFNCFilterViewRadioGroup.Create(FilterView);
//Properties used when they aren't added in the FilterExpressions
filterRadioGroup.DefaultFilterProperties.FilterFieldName := 'Delivery';
filterRadioGroup.DefaultFilterProperties.FilterFieldType := fdtText;
filterRadioGroup.DefaultFilterProperties.ExpressionOperator := feoEqual;
filterRadioGroup.Items.AddStrings(['Pick-up store', 'TMS Post', 'Fast Transport', 'Pack AG ING']);
//The filterItem will be added when the parent is set.
filterRadioGroup.Parent := FilterView;
filterRadioGroup.FilterExpressions.AddOrUpdateExpression('Pick-up store','',False); //Don't add it to the filter
filterRadioGroup.ItemIndex := 0;
end;
TTMSFNCFilterViewTrackBar
TTMSFNCFilterViewTrackBar provides a trackbar control for numeric range filtering.
It's ideal for filtering numeric values within a specific range, such as prices, quantities, or ratings.
The control supports customizable min/max values, tick marks, and value display.
By default the value from the trackbar will be used in the filter text.
Properties
Specific to the FilterView, for other events see the TTMSFNCTrackBar.
| Property | Description |
|----------|-------------|
| DefaultFilterProperties | Gets or sets the default properties for new expressions. These defaults are applied when creating expressions without explicit parameters. |
| FilterExpressions | Collection that manages filter expressions for specific values. |
Events
Specific to the FilterView, for other events see the TTMSFNCTrackBar.
| Event | Description |
|-------|-------------|
| OnSetFilterItem | Occurs when setting filter item parameters. Allows customization of filter item properties before they're applied. |
Code Example
uses
TMS.TMSFNCFilterBuilder, FMX.TMSFNCUtils;
procedure TFormFilterView.FormCreate(Sender: TObject);
var
filterTrackBar: TTMSFNCFilterViewTrackBar;
begin
filterTrackBar := TTMSFNCFilterViewTrackBar.Create(FilterView);
filterTrackBar.Min := 0;
filterTrackBar.Max := 5;
//Properties used when they aren't added in the FilterExpressions
filterTrackBar.DefaultFilterProperties.FilterFieldName := 'VidQuality';
filterTrackBar.DefaultFilterProperties.PropertyFilterFieldType := fdtText;
filterTrackBar.DefaultFilterProperties.ExpressionOperator := feoEqual;
filterTrackBar.Parent := FilterView;
filterTrackBar.BeginUpdate;
filterTrackBar.FilterExpressions.Clear; //Default already empty
filterTrackBar.FilterExpressions.AddOrUpdateExpression('0', 'All', False); //Not necessary to add to the filter
filterTrackBar.FilterExpressions.AddOrUpdateExpression('1', '1440p', True);
filterTrackBar.FilterExpressions.AddOrUpdateExpression('2', '1080p', True);
filterTrackBar.FilterExpressions.AddOrUpdateExpression('3', '720p', True);
filterTrackBar.FilterExpressions.AddOrUpdateExpression('4', '480p', True);
filterTrackBar.FilterExpressions.AddOrUpdateExpression('5', 'Custom', True);
filterTrackBar.Value := 1;
filterTrackBar.EndUpdate;
end;
TTMSFNCFilterViewRangeSlider
TTMSFNCFilterViewRangeSlider provides a dual-thumb slider control for filtering values within a range.
Perfect for scenarios where you need both minimum and maximum bounds, such as date ranges, price ranges, or any numeric interval filtering.
By default the value for both thumbs will be used in the filter text.
Properties
| Property | Description |
|---|---|
| GroupOperator | Gets or sets the logical operator (AND/OR) to combine the left and right value. |
| DefaultLeftFilterProperties | Gets or sets the default properties of the Left Thumb for new or empty expressions. These defaults are applied when creating expressions without explicit parameters. |
| DefaultRightFilterProperties | Gets or sets the default properties of the Right Thumb for new or empty expressions. These defaults are applied when creating expressions without explicit parameters. |
| FilterLeftExpressions | Collection that manages filter expressions for the Left Thumb on specific values. |
| FilterRightExpressions | Collection that manages filter expressions for the Left Thumb on specific values. |
Events
| Event | Description |
|---|---|
| OnSetLeftFilterItem | Occurs when setting the Left Value. Allows customization of filter item properties before they're applied. |
| OnSetRightFilterItem | Occurs when setting the Right Value. Allows customization of filter item properties before they're applied. |
Code Example
uses
TMS.TMSFNCFilterBuilder, FMX.TMSFNCUtils;
procedure TFormFilterView.FormCreate(Sender: TObject);
var
filterRangeSlider: TTMSFNCFilterViewRangeSlider;
begin
filterRangeSlider := TTMSFNCFilterViewRangeSlider.Create(FilterView);
filterRangeSlider.BeginUpdate;
filterRangeSlider.Parent := FilterView;
filterRangeSlider.Min := 0;
filterRangeSlider.Max := 5;
//Properties used when they aren't added in the FilterExpressions
filterRangeSlider.LeftDefaultFilterProperties.FilterFieldName := 'Date';
filterRangeSlider.LeftDefaultFilterProperties.PropertyFilterFieldType := fdtDateTime;
filterRangeSlider.LeftDefaultFilterProperties.ExpressionOperator := feoLargerThanOrEqual;
//Properties used when they aren't added in the FilterExpressions
filterRangeSlider.RightDefaultFilterProperties.FilterFieldName := 'Date';
filterRangeSlider.RightDefaultFilterProperties.PropertyFilterFieldType := fdtDateTime;
filterRangeSlider.RightDefaultFilterProperties.ExpressionOperator := feoSmallerThanOrEqual;
filterRangeSlider.LeftFilterExpressions.Clear; //Default already empty
filterRangeSlider.LeftFilterExpressions.AddOrUpdateExpression('0', DateToStr(EncodeDate(1970,1,1), FormatSettings));
filterRangeSlider.LeftFilterExpressions.AddOrUpdateExpression('1', DateToStr(EncodeDate(1980,1,1), FormatSettings));
filterRangeSlider.LeftFilterExpressions.AddOrUpdateExpression('2', DateToStr(EncodeDate(1990,1,1), FormatSettings));
filterRangeSlider.LeftFilterExpressions.AddOrUpdateExpression('3', DateToStr(EncodeDate(2000,1,1), FormatSettings));
filterRangeSlider.LeftFilterExpressions.AddOrUpdateExpression('4', DateToStr(EncodeDate(2010,1,1), FormatSettings));
filterRangeSlider.LeftFilterExpressions.AddOrUpdateExpression('5', DateToStr(EncodeDate(2020,1,1), FormatSettings));
filterRangeSlider.LeftFilterExpressions.AddOrUpdateExpression('6', DateToStr(EncodeDate(2030,1,1), FormatSettings));
filterRangeSlider.RightDefaultFilterProperties...
filterRangeSlider.EndUpdate;
end;
uses
TMS.TMSFNCFilterBuilder, FMX.TMSFNCUtils;
procedure TFormFilterView.FormCreate(Sender: TObject);
var
filterRangeSlider: TTMSFNCFilterViewRangeSlider;
sl: TStringList;
begin
filterRangeSlider := TTMSFNCFilterViewRangeSlider.Create(FilterView);
filterRangeSlider.BeginUpdate;
filterRangeSlider.Parent := FilterView;
filterRangeSlider.Min := 0;
filterRangeSlider.Max := 5;
filterRangeSlider.SetDefaultFilterProperties('Date', fdtDateTime, feoLargerThanOrEqual, feoSmallerThanOrEqual);
sl := TStringList.Create;
try
sl.Add(DateToStr(EncodeDate(1970,1,1), FormatSettings));
sl.Add(DateToStr(EncodeDate(1980,1,1), FormatSettings));
sl.Add(DateToStr(EncodeDate(1990,1,1), FormatSettings));
sl.Add(DateToStr(EncodeDate(2000,1,1), FormatSettings));
sl.Add(DateToStr(EncodeDate(2010,1,1), FormatSettings));
sl.Add(DateToStr(EncodeDate(2020,1,1), FormatSettings));
sl.Add(DateToStr(EncodeDate(2030,1,1), FormatSettings));
filterRangeSlider.CreateExpressionsForValues(sl);
finally
sl.Free;
end;
filterRangeSlider.EndUpdate;
end;
TTMSFNCFilterViewComboBox
TTMSFNCFilterViewComboBox provides a ComboBox control for item selection.
By default the text from the selected item will be used in the filter text.
Properties
Specific to the FilterView, for other events see the TTMSFNCComboBox.
| Property | Description |
|----------|-------------|
| DefaultFilterProperties | Gets or sets the default properties for new expressions. These defaults are applied when creating expressions without explicit parameters. |
| FilterExpressions | Collection that manages filter expressions for specific values. |
| UseItemTextForPropertyValue | Default True, if set to False the ItemIndex will be used for the Expressions instead of the text of the item. |
Events
Specific to the FilterView, for other events see the TTMSFNCComboBox.
| Event | Description |
|-------|-------------|
| OnSetFilterItem | Occurs when setting filter item parameters. Allows customization of filter item properties before they're applied. |
Code Example
uses
TMS.TMSFNCFilterBuilder, FMX.TMSFNCUtils;
procedure TFormFilterView.FormCreate(Sender: TObject);
var
filterTrackBar: TTMSFNCFilterViewTrackBar;
begin
filterComboBox := TTMSFNCFilterViewComboBox.Create(FilterView);
filterComboBox.DefaultFilterProperties.FilterFieldName := 'AREA';
filterComboBox.Items.AddStrings(['Africa', 'Antarctica', 'Asia', 'Europe', 'Oceania', 'North-America', 'South-America']);
filterComboBox.ItemIndex := 0;
filterComboBox.Parent := FilterView;
end;
TTMSFNCFilterViewDatePicker
TTMSFNCFilterViewDatePicker provides a DatePicker control to help you with Date/Time properties.
Properties
| Property | Description |
|---|---|
| DefaultFilterProperties | Gets or sets the default properties for new expressions. These defaults are applied when creating expressions without explicit parameters. |
| FilterExpressions | Collection that manages filter expressions for specific values. |
Events
| Event | Description |
|---|---|
| OnSetFilterItem | Occurs when setting filter item parameters. Allows customization of filter item properties before they're applied. |
TTMSFNCFilterViewCheckBox
TTMSFNCFilterViewItemControlCheckBox provides a checkbox control for the Filter View.
The control automatically manages the relationship between checkbox state and filter expression.
With the Expressions used all values can be added or set as requested.
By default the checkbox will add a true value when selected and nothing when it isn't checked. You can change and add different Expressions for other values in the example below we will configure a checkbox that will set text when the checkbox is not checked.
Properties
Specific to the FilterView, for other events see the TTMSFNCCheckBox.
| Property | Description |
|----------|-------------|
| DefaultFilterProperties | Gets or sets the default properties for new expressions. These defaults are applied when creating expressions without explicit parameters. |
| FilterExpressions | Collection that manages filter expressions for specific values. |
Events
Specific to the FilterView, for other events see the TTMSFNCCheckBox.
| Event | Description |
|-------|-------------|
| OnSetFilterItem | Occurs when setting filter item parameters. Allows customization of filter item properties before they're applied. |
Code Example
uses
TMS.TMSFNCFilterBuilder, FMX.TMSFNCUtils;
procedure TFormFilterView.FormCreate(Sender: TObject);
var
filterCheckBox: TTMSFNCFilterViewCheckBox;
begin
filterCheckBox := TTMSFNCFilterViewCheckBox.Create(FilterView);
//Properties used when they aren't added in the FilterExpressions
filterCheckBox.DefaultFilterProperties.FilterFieldName := 'Role';
filterCheckBox.DefaultFilterProperties.FilterFieldType := fdtText;
filterCheckBox.DefaultFilterProperties.ExpressionOperator := feoEqual;
//The filterItem will be added when the parent is set.
filterCheckBox.Parent := FilterView;
filterCheckBox.FilterExpressions.Clear; //Default it has a boolean value True added
filterCheckBox.FilterExpressions.AddOrUpdateExpression('True', feoNotEqual, 'Admin', False); //Don't add it to the filter
filterCheckBox.FilterExpressions.AddOrUpdateExpression('False', 'Admin');
end;
TTMSFNCFilterViewRadioButton
TTMSFNCFilterViewItemControlRadioButton provides a radio button control for exclusive selection filtering.
With the Expressions used all values can be added or set as requested.
Radio buttons in the same group (with the same group name) automatically handle exclusivity.
See the checkbox code example on how to create a RadioButton.
Properties
Specific to the FilterView, for other events see the TTMSFNCRadioButton.
| Property | Description |
|----------|-------------|
| DefaultFilterProperties | Gets or sets the default properties for new expressions. These defaults are applied when creating expressions without explicit parameters. |
| FilterExpressions | Collection that manages filter expressions for specific values. |
Events
Specific to the FilterView, for other events see the TTMSFNCRadioButton.
| Event | Description |
|-------|-------------|
| OnSetFilterItem | Occurs when setting filter item parameters. Allows customization of filter item properties before they're applied. |
TTMSFNCFilterViewExpressionValueEdit
TTMSFNCFilterViewExpressionValueEdit gives the ability to let the user choose the expression and value.
Which you sometimes see in grid filters. It is a combination of a ComboBox and an Edit.
Properties
| Property | Description |
|---|---|
| UILanguage | The textual representation for different operators that are used in the filter. |
| FilterExpression | The Expression that will be used in the filter item. |
Events
| Event | Description |
|---|---|
| OnSetFilterItem | Occurs when setting filter item parameters. Allows customization of filter item properties before they're applied. |
TTMSFNCFilterViewExpressionValueEdit
TTMSFNCFilterViewExpressionValueEdit gives the ability to let the user choose the expression and value.
Which you sometimes see in grid filters. It is a combination of a ComboBox and an Edit.
Properties
| Property | Description |
|---|---|
| UILanguage | The textual representation for different operators that are used in the filter. |
| FilterExpression | The Expression that will be used in the filter item. |
Events
| Event | Description |
|---|---|
| OnSetFilterItem | Occurs when setting filter item parameters. Allows customization of filter item properties before they're applied. |
TTMSFNCFilterViewControlContainer
TTMSFNCFilterViewControlContainer is a container that you can use to place any control as a sub-control.
Updating the filter view is done immediately from the FilterExpression.
Properties
| Property | Description |
|---|---|
| FilterExpression | The Expression that will be used in the filter item. |
Events
| Event | Description |
|---|---|
| OnSetFilterItem | Occurs when setting filter item parameters. Allows customization of filter item properties before they're applied. |
procedure Form.CalendarDateSelected(Sender: TObject; ADate: TDate);
begin
TMSFNCFilterViewControlContainer1.FilterExpression.FilterValue := ADate;
TMSFNCFilterViewControlContainer1.FilterExpression.AddToFilter := ADate <> 0;
end;
Add a Filter Item for an existing control
The FilterView has some functionality to add filter items based on a non-filter control.
Methods
| Method | Description |
|---|---|
| GetCustomItemControlFilterItem | Returns the filter structure item associated with the given control, if it was previously added as a custom filter item. |
| GetControlFilterGroupItems | Retrieves the filter structure items belonging to the group in which the specified control is registered. |
| UpdateCustomItemControlValue | Updates the value stored in the custom filter item linked to the control. Returns True if the control has a registered filter item and it was successfully updated. |
| UpdateCustomGroupControlOperator | Updates the logical operator (AND/OR) for the group associated with the control. Returns True if the update succeeds. |
| AddCustomItemControl | Registers a control as a custom filter item and adds its filter expression to an existing collection of filter structure items. Ideal for manually extending the filter tree. |
| AddCustomGroupControl | Creates a new filter group (AND/OR) associated with a custom control and inserts it into the provided group item collection. |
| RemoveCustomItemControl | Removes a previously added custom item control and its corresponding filter item(s) from the filter structure. Returns True if removal was successful. |
Code Example
FNCFilterView.AddCustomItemControl(TMSFNCCalendar, TMSFNCCalendar.SelectedDate, 'Date', fdtDate);
procedure TForm5.TMSFNCDatePicker2DateSelected(Sender: TObject; ADate: TDate);
begin
TMSFNCFilterView1.UpdateCustomItemControlValue(TMSFNCCalendar, ADate);
end;
Best Practices
-
Use BeginUpdate/EndUpdate when adding multiple controls to improve performance and prevent flicker.
-
Handle OnExpressionNotFound to support dynamic filter creation for unknown values.
-
Use appropriate control types based on data types and user experience requirements.
-
Configure DefaultFilterProperties to reduce repetitive code when expressions share common settings.
-
Test filter expressions with your actual data to ensure proper formatting and operator compatibility.
-
Consider accessibility by setting proper titles and labels for all filter controls.
Tips and Troubleshooting
Common Issues and Solutions
-
Filter not updating: Ensure
FilterExpression.AddToFilteris set toTrue. -
Radio buttons not exclusive: Set the same
GroupNamefor all related radio buttons. -
Custom formatting not working: Check that event handlers are properly assigned before control creation completes.
-
Performance issues with many controls: Use
BeginUpdate/EndUpdateand consider virtual scrolling for large filter sets. -
Filter text formatting issues: Verify
FilterFormatTypematches your data source requirements. -
Error when linked to DataSet: The DataSet filter is very strict on what text it takes. When adding controls programmatically make sure to set the Expressions before adding the filter item. (When setting the parent.)