Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
unit SUnit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm2 = class(TForm)
CheckBox1: TCheckBox;
procedure CheckBox1Click(Sender: TObject);
procedure CheckBox1KeyUp(Sender: TObject;
var Key: Word; Shift: TShiftState)
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
uses MUnit1;
//handle the change through a mouse click
procedure TForm2.CheckBox1Click(Sender: TObject);
begin
if CheckBox.Checked then
MUnit1.Form1.Button1.Font.Color := crGreen
else
MUnit1.Form1.Button1.Font.Color := crBlack;
application.processmessages;
end;
//handle the change through the keyboard
procedure TForm2.CheckBox1KeyUp(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
if Key = VK_SPACE then //spacebar to change
CheckBox1Click(Sender);
end;
end.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
uses
Unit2;
procedure TForm1.Button1Click(Sender: TObject);
var
myButtonHolder: TButtonClass;
begin
myButtonHolder := TButtonClass.Create;
myButtonHolder.AButton := Button1;
myButtonHolder.ALabel := Label1;
with TForm2.Create(Application) do
try
Setup(myButtonHolder);
ShowModal;
finally
Free;
end;
end;
end.
unit Unit2;
interface
uses
Unit1,
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TButtonClass = class
private
FButton: TButton;
FLabel: TLabel;
public
property AButton: TButton read FButton write FButton;
property ALabel: TLabel read FLabel write FLabel;
end;
TForm2 = class(TForm)
Edit1: TEdit;
Button1: TButton;
procedure Edit1Change(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
ButtonHolder: TButtonClass;
public
procedure Setup(bh: TButtonClass);
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
{ TForm2 }
procedure TForm2.Setup(bh: TButtonClass);
begin
ButtonHolder := bh;
end;
procedure TForm2.Edit1Change(Sender: TObject);
begin
ButtonHolder.ALabel.Caption := Edit1.Text;
end;
procedure TForm2.Button1Click(Sender: TObject);
begin
ButtonHolder.AButton.Caption := Edit1.Text;
end;
end.