E
E
Evgeny Ivanov2016-11-18 11:31:01
Delphi
Evgeny Ivanov, 2016-11-18 11:31:01

How to hide the first form and show the second when the program starts?

Delphi 7. The simplest task is to hide form 1 and show form 2.
The first form without changing properties, the second visible=false;
It is necessary that when loading / showing the first form, this form is hidden and the second one is shown.
First form code

procedure TForm1.FormCreate(Sender: TObject);
begin
form2.Show;
form1.hide;
end;

An error occurs - Can not change visible OnShow or OnHide.
And if we do everything at the click of a button, we will get the desired result.
procedure TForm1.Button1Click(Sender: TObject);
begin
form2.Show;
form1.hide;
end;

But it is necessary automatically, when the program starts (loading the main form).
How to hide the first form and show the second when the program starts?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Fedoryan, 2016-11-18
@AnnTHony

The second form at the time of the show most likely has not yet been created.
There is no Delphi at hand. That won't work?

procedure TForm1.FormCreate(Sender: TObject);
begin
form1.hide;
end;

procedure TForm2.FormCreate(Sender: TObject);
begin
form2.Show;
end;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question