If you’re looking for a quick and easy way to update an in-memory data table, the Update Switch Demo is the perfect solution. Built in Delphi, this cross-platform application is designed to work on Android, iOS, macOS, Windows, and Linux. With a single code base and single UI, it’s easy to keep your data updated across all your devices. Plus, the Live Bindings feature makes it super simple to update your data when a switch control changes. So if you need a fast and reliable way to keep your data up-to-date, the Update Switch Demo is the perfect tool for the job.
Download the full cross-platform data binding switch 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.
Table of Contents
What is a switch button in software development?
switch button is a graphical control element that allows the user to switch between different options. It is typically used to switch between different views or modes in a software application. For example, a switch button could be used to switch between the “design” and “code” views in a web development IDE. Switch buttons are also commonly used to switch between different sets of options in a settings menu. For example, a switch button could be used totoggle between different display modes (e.g., landscape and portrait). In general, switch buttons provide a quick and convenient way for users to switch between different options in a software application.
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 |
unit Unit1; interface uses System.SysUtils, System.Types, System.UITypes, System.Classes, 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, FMX.StdCtrls, Data.Bind.Components, Data.Bind.DBScope, Data.DB, FireDAC.Comp.DataSet, FireDAC.Comp.Client, FMX.Effects, FMX.Controls.Presentation; type TForm1 = class(TForm) MaterialOxfordBlueSB: TStyleBook; ToolBar1: TToolBar; ShadowEffect4: TShadowEffect; Label1: TLabel; Label2: TLabel; <strong> FDMemTable1: TFDMemTable; BindSourceDB1: TBindSourceDB; BindingsList1: TBindingsList; LinkPropertyToFieldText: TLinkPropertyToField; Switch1: TSwitch; LinkControlToField2: TLinkControlToField;</strong> private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.fmx} end. |
What does the data bindings look like?
What do the Form objects control 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 LinkControlToField2: TLinkControlToField Category = 'Quick Bindings' DataSource = BindSourceDB1 FieldName = 'Value' Control = Switch1 Track = True 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. Compile. Deploy.
Start Free TrialUpgrade Today
Free Delphi Community EditionFree C++Builder Community Edition