TTMSFNCResponsiveList Class
Displays a collection of items in a list whose layout responds to the available size, switching between templates defined by a set of size-based conditions.
API unit family: TMSFNCResponsiveList
Inherits from: TTMSFNCRECustomScrollControl
Implements: ITMSFNCPersistence
Syntax
TTMSFNCResponsiveList = class(TTMSFNCRECustomScrollControl, ITMSFNCPersistence)
class PASCALIMPLEMENTATION TTMSFNCResponsiveList : public TTMSFNCRECustomScrollControl, public ITMSFNCPersistence
Properties
| Name | Description |
|---|---|
| Appearance | Controls the appearance applied to items and their header/footer, such as colors, borders, and shadow. |
| BitmapContainer | Bitmap container used to resolve bitmap references used by item content and templates. |
| ConditionCategory | Restricts which responsive conditions are considered active, so only conditions matching this category are evaluated. |
| Conditions | Holds the set of size-based conditions that determine which layout template is applied at the current width and height. |
| Cursor | Cursor displayed when the mouse pointer is over the list. |
| FilterCondition | Condition used to filter items, combining the filter text, matching mode, and which parts of an item are searched. |
| Images | Image list that resolves image indexes referenced by item content and templates. |
| ItemIndex | Index of the currently selected item. |
| Items | Collection of items displayed by the list. |
| MultiSelect | Determines whether more than one item can be selected at the same time. |
| TabStop | Determines whether the list accepts input focus via the Tab key. |
| Version | Version of the control, exposed for reporting and support purposes. |
Methods
| Name | Description |
|---|---|
| AnchorAtPoint | Determines whether a point falls on an anchor rendered inside an item's content. |
| BeginUpdate | Suspends repainting and layout updates so a batch of changes can be applied without intermediate redraws. |
| ClearFilter | Removes any active filtering, making every item visible again. |
| ClearSelection | Clears the selection state of every item in the list. |
| ControlAtPoint | Determines whether a point falls on a control rendered inside an item's content. |
| CopyToClipboard | Copies the current selection to the clipboard. |
| CutToClipboard | Copies the current selection to the clipboard and removes it from the list. |
| DoEnter | Handles the control receiving input focus, refreshing the list to reflect the focused state. |
| DoExit | Handles the control losing input focus, refreshing the list to reflect the unfocused state. |
| EndUpdate | Resumes repainting and layout updates after a matching call to BeginUpdate, and refreshes the list. |
| FindControlItem | Finds the item that owns a given embedded control. |
| FindItemAtPoint | Finds the item located at a given point. |
| LoadSettingsFromFile | Loads a configuration previously saved with SaveSettingsToFile. |
| LoadSettingsFromStream | Loads a configuration previously saved with SaveSettingsToStream. |
| PasteFromClipboard | Pastes the clipboard content into the list. |
| SaveSettingsToFile | Saves the current configuration to a file. |
| SaveSettingsToStream | Saves the current configuration to a stream. |
| ScrollInView | Scrolls the list so the specified item becomes fully visible. |
| UpdateFilter | Re-evaluates the filter condition and updates which items are filtered out based on FilterCondition. |
Events
| Name | Description |
|---|---|
| OnAfterDrawItem | Occurs right after an item has been drawn, allowing extra content to be painted on top of it. |
| OnAfterSelectItem | Occurs after an item has been selected. |
| OnBackgroundDraw | Occurs when the background of the list is drawn, allowing custom background painting. |
| OnBeforeDrawItem | Occurs immediately before an item is drawn, allowing the default drawing to be replaced. |
| OnBeforeSelectItem | Occurs before an item is selected, and can disallow the selection. |
| OnConditionChange | Occurs when the active responsive condition changes, for example after the list is resized. |
| OnItemAnchorClick | Occurs when the user clicks an anchor rendered inside an item's content. |
| OnItemClick | Occurs when the user clicks an item. |
| OnItemControlClick | Occurs when the user clicks a control embedded inside an item's content. |
| OnItemDblClick | Occurs when the user double-clicks an item. |
| OnItemEnter | Occurs when the mouse pointer enters an item. |
| OnItemFilter | Occurs while filtering, for each item, allowing the built-in filter match to be overridden. |
| OnItemLeave | Occurs when the mouse pointer leaves an item. |
Usage examples
Create a custom responsive list item
Uses a custom item class and list descendant to draw extra item state after the inherited item rendering.
type
TStatusResponsiveListItem = class(TResponsiveListItem)
private
FStatusText: string;
protected
procedure DrawItem(AGraphics: TTMSFNCGraphics; ATemplate, AHeaderTemplate,
AFooterTemplate: string; ARect: TRect; Focus: Boolean); override;
published
property StatusText: string read FStatusText write FStatusText;
end;
TStatusResponsiveList = class(TTMSFNCResponsiveList)
protected
function GetItemClass: TCollectionItemClass; override;
end;
procedure TStatusResponsiveListItem.DrawItem(AGraphics: TTMSFNCGraphics;
ATemplate, AHeaderTemplate, AFooterTemplate: string; ARect: TRect;
Focus: Boolean);
begin
inherited DrawItem(AGraphics, ATemplate, AHeaderTemplate, AFooterTemplate,
ARect, Focus);
AGraphics.DrawText(ARect, StatusText);
end;
function TStatusResponsiveList.GetItemClass: TCollectionItemClass;
begin
Result := TStatusResponsiveListItem;
end;