Do you need an easy way to keep your DateEdit control up-to-date? Then you need the Update DateEdit Demo! This cross-platform application makes it a breeze to update your DateEdit control through an in-memory data table, regardless of which operating system you’re using. And because it’s built in Delphi, you can be sure that the code is clean and reliable. So why wait? Get the Update DateEdit Demo today!
Download the full cross-platform DateEdit data binding source code on Github.
This demo is part of over 100 cross-platform demos with everything from camera demos to emoji demos and painting demos.
Inhaltsverzeichnis
What is a DateEdit control in software development?
A date edit control is a software development tool that allows you to input, edit and format date information. It is typically used in applications where date data needs to be entered or displayed, such as calendars, scheduling tools and email clients. Date edit controls usually have a variety of features that make date entry and management easy, such as the ability to add or subtract days, weeks, months or years. Some date edit controls also allow you to set date ranges or specify date formats. In general, date edit controls can greatly simplify the process of inputting and manipulating date data.
Screenshot
What does the source code look like?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
unit Unit1; interface uses System.SysUtils, System.Types, System.UITypes, System.Klassen, System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param, FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf, FireDAC.Stan.StorageBin, Data.Bind.EngExt, Fmx.Bind.DBEngExt, System.Rtti, System.Bindings.Outputs, Fmx.Bind.Editors, Data.Bind.Komponenten, FMX.DateTimeCtrls, Data.Bind.DBScope, Data.DB, FireDAC.Comp.DataSet, FireDAC.Comp.Client, FMX.Edit, FMX.StdCtrls, FMX.Effects, FMX.Controls.Presentation; type TForm1 = Klasse(TForm) MaterialOxfordBlueSB: TStyleBook; ToolBar1: TToolBar; ShadowEffect4: TShadowEffect; Label1: TLabel; Label2: TLabel; BehindEdit1: TEdit; <strong> FDMemTable1: TFDMemTable; BindSourceDB1: TBindSourceDB; BindingsList1: TBindingsList; LinkPropertyToFieldText: TLinkPropertyToField; DateEdit1: TDateEdit; LinkControlToField1: TLinkControlToField; procedure DateEdit1Change(Sender: TObject); procedure BehindEdit1Validate(Sender: TObject; var Text: string); procedure FormCreate(Sender: TObject);</strong> private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.fmx} <strong>procedure TForm1.DateEdit1Change(Sender: TObject); Start BehindEdit1.Text := DateEdit1.Text; TLinkObservers.ControlChanged(BehindEdit1); end; procedure TForm1.BehindEdit1Validate(Sender: TObject; var Text: string); var LValue: TDateTime; Start LValue := StrToDateTime(Text); if LValue<>DateEdit1.DateTime then DateEdit1.DateTime := StrToDateTime(Text); end; procedure TForm1.FormCreate(Sender: TObject); Start BehindEdit1.Text := DateTimeToStr(Now); end;</strong> end. |
What does the data bindings look like?
What does the Form object code look like?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
object BindSourceDB1: TBindSourceDB DataSet = FDMemTable1 ScopeMappings = <> Left = 144 Top = 224 end object BindingsList1: TBindingsList Methods = <> OutputConverters = <> Left = 20 Top = 5 object LinkPropertyToFieldText: TLinkPropertyToField Category = 'Quick Bindings' DataSource = BindSourceDB1 FieldName = 'Value' Component = Label2 ComponentProperty = 'Text' end object LinkControlToField1: TLinkControlToField Category = 'Quick Bindings' DataSource = BindSourceDB1 FieldName = 'Value' Control = BehindEdit1 Track = False end end |
Ready to learn how to program cross-platform apps like this?
Sign up for the Coding Boot Camp 2022 to learn to program. Topics include: Games, JavaScript, Web, Python, SQL, Databases, iOS, MacOS, Android, Mobile, Linux, Windows, Desktop, Server, and Arduino.
Design. Code. Kompilieren. Bereitstellen.
Kostenlos testenUpgrade heute
Kostenlose Delphi Community EditionKostenlose C ++ Builder Community Edition