@lucamar
After i run the program, i try to click the "start game" button to test whether Form3.show works or not, but the error message popup.
This will be my program now after applied your suggestion.
unit unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
Buttons, unit2, unit3;
type
{ TForm1 }
TForm1 = class(TForm)
Instrc: TLabel;
Name1: TLabel;
Startg: TLabel;
procedure InstrcClick(Sender: TObject);
procedure InstrcMouseEnter(Sender: TObject);
procedure InstrcMouseLeave(Sender: TObject);
procedure StartgClick(Sender: TObject);
procedure StartgMouseEnter(Sender: TObject);
procedure StartgMouseLeave(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.StartgMouseEnter(Sender: TObject);
begin
Startg.Font.Style:=[fsBold];
end;
procedure TForm1.StartgMouseLeave(Sender: TObject);
begin
Startg.Font.Style:= [];
end;
procedure TForm1.StartgClick(Sender: TObject);
begin
if not Assigned(Form3) then
Application.CreateForm(TForm3, Form3);
Form3.Show;
Self.Hide;
{WARNING!
The following is *NOT* recommended!!!.
The proper thing to do is have Form3 show Form1
when it has ended v.g. in an OnCloseQuery handler.}
while Form3.Showing do
Application.ProcessMessages;
Self.Show;
{/WARNING}
end;
procedure TForm1.InstrcClick(Sender: TObject);
begin
Form2.show;
end;
procedure TForm1.InstrcMouseEnter(Sender: TObject);
begin
Instrc.Font.Style:= [fsBold];
end;
procedure TForm1.InstrcMouseLeave(Sender: TObject);
begin
Instrc.Font.Style:= [];
end;
end.