FMX.ComboEdit.TComboEditModel
Delphi
TComboEditModel = class(TCustomEditModel)
C++
class PASCALIMPLEMENTATION TComboEditModel : public Fmx::Edit::TCustomEditModel
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
class | public | FMX.ComboEdit.pas FMX.ComboEdit.hpp |
FMX.ComboEdit | FMX.ComboEdit |
Description
Data models for presented controls.
FMX.ComboEdit.TComboEditModel inherits from FMX.Controls.Model.TDataModel. All content below this line refers to FMX.Controls.Model.TDataModel.
Data models for presented controls.
TDataModel is the base class of data models for presented controls. Descendant classes define properties that store data values used by properties of corresponding presented controls.
TDataModel extends TMessageSender, which provides the sending messages functionality. A Data model can define a Receiver (or presentation) and send messages to this Receiver, when a Data model's data is changed, to update the values shown in the associated presented control. When a Data model reads or writes Data values the Data model sends MM_GETDATA
and MM_DATA_CHANGED
messages to a presentation.
TDataModel defines the DataSource property containing a collection of key-value pairs. Keys are strings and values are instances of TValue. Since the TValue type can keep and handle any arbitrary type data; therefore, the DataSource collection can keep any required data. This means that to keep any type data TDataModel does not need to create a new separate class. For example, it can keep an array of strings, which can be used as a collection of prompt words in an editor. Like this:
type
TStringArray = TArray<string>;
var
ArrayList1, ArrayList2: TStringArray;
...
{ Setting/Getting value of array type }
ArrayList1 := ['Apple', 'ARC', 'Auto', 'Allday', 'Alltime'];
Edit1.Model.Data['array_value'] := TValue.From<TStringArray>(ArrayList1);
...
if Edit1.Model.Data['array_value'].IsType<TStringArray> then
ArrayList2 := Edit1.Model.Data['array_value'].AsType<TStringArray>;
When you create a data model, you must pass a presentation control to the constructor. The specified presentation control owns the model.
See Also
- FMX.Controls.Model.TDataModel.DataSource
- FMX.Controls.Model.TDataModel.Data
- System.Generics.Collections.TDictionary
- FMX.Controls.Presentation.TPresentedControl
- FMX.Presentation.Messages.TMessageSender.Receiver
- FMX.Controls.Presentation.TPresentedControl.Model
- FMX.Controls.Model.TDataModel.Owner
- System.String
- System.Rtti.TValue