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.
action := caFree;
unit second;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs;
type
TForm2 = class(TForm)
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
class function FormExists: Boolean;
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caFree;
end;
class function TForm2.FormExists: Boolean;
var
F: TForm2;
I: Integer;
begin
F := nil;
for i := Screen.FormCount - 1 DownTo 0 do
if (Screen.Forms[i].Name = 'Form2') then
F := Screen.Forms[I] As TForm2;
if F = nil then
Result := False
else
result := True;
end;
end.
uses Form2Unit;
procedure TForm1.BitBtn1Click(Sender: TObject);
var
Child: TForm2;
begin
if Not TForm2.FormExists then
begin
Child := TForm2.Create(Application);
Child.Show;
end;
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
var
fForm2: TForm2;
begin
fForm2 := TForm2.Create(Application);
try
//here you can initialize form variables
fForm2.ShowModal;
//here you can read data from the form
finally
fForm2.Free;
end;
end;