The Update Checkbox Demo is the perfect way to show how Live Bindings can be used to update a label when a checkbox changes. It is a cross-platform application that has been built in Delphi using a single code base and single UI for Android, iOS, macOS, Windows, and Linux. This makes it the perfect tool for anyone who wants to learn how to build cross-platform applications using Live Bindings.
Download the full cross-platform update checkbox demo 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 checkbox in software development?
Checkboxes are a type of input element in software development that allows the user to select multiple options from a list. These options are typically presented as a list of checkboxes, each with a corresponding label. Checkboxes are often used in forms, such as surveys or sign-up forms, as they allow the user to select multiple options without having to enter each one individually. When checkboxes are used in this way, they are often referred to as “multiple-choice” or “select all that apply” inputs. In addition to forms, checkboxes are also commonly used in menus and other interfaces where multiple selection is desired. Checkboxes are usually accompanied by labels that describe the option or options that can be selected. For example, a checkbox labeled “I agree” might be used to indicate that the user agrees to the terms and conditions of a website. Checkboxes can also be programmed to perform certain actions when selected, such as opening a new window or changing the display mode of an interface.
What is a boolean in software development?
A boolean is a data type that can have one of two values, usually represented by the integers 0 and 1. In software development, boolean values are often used to represent the truth or falsehood of a statement. For example, a boolean variable might be used to keep track of whether a user is logged in or not. When the user logs in, the variable would be set to true; when the user logs out, the variable would be set to false. Boolean values can also be used in mathematical operations. For example, the boolean AND operation takes two boolean values and returns true if both values are true; otherwise, it returns false. Similarly, the boolean OR operation takes two boolean values and returns true if either value is true; if both values are false, it returns false. Boolean values are an important part of many programming languages and are commonly used in software development.
Screenshot
What does the source code of the checkbox demo 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 |
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.StdCtrls, Data.Bind.DBScope, Data.DB, FireDAC.Comp.DataSet, FireDAC.Comp.Client, FMX.Effects, FMX.Controls.Presentation; type TForm1 = Klasse(TForm) MaterialOxfordBlueSB: TStyleBook; ToolBar1: TToolBar; ShadowEffect4: TShadowEffect; Label1: TLabel; Label2: TLabel; <strong> FDMemTable1: TFDMemTable; BindSourceDB1: TBindSourceDB; BindingsList1: TBindingsList; CheckBox1: TCheckBox; LinkPropertyToFieldText: TLinkPropertyToField; LinkControlToField1: TLinkControlToField;</strong> private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.fmx} end. |
What does the data binding component object 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 |
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 = CheckBox1 Track = True end end |
What do the data bindings look like for the boolean checkbox control?
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