2
I have an application that has 4 forms.
After the process there is a button for the person to start again.
procedure TForm4.Button3Click(Sender: TObject);
begin
FreeAndNil(Form1);
FreeAndNil(Form2);
FreeAndNil(Form3);
FreeAndNil(Form4); //Libera o form da memória
Application.CreateForm(Tform1, form1);
Application.CreateForm(Tform2, form2);
Application.CreateForm(Tform3, form3);
Application.CreateForm(Tform4, form4);
Application.Run; //Roda a aplicação
end;
Until then ok, but in case she presses the close button .
Displays the following message:
It crashes, appears the windows message to close the program, and just so it closes.
Obs: (The error only appears if the person clicks the button to start the process again, if she opens the program for the first time, it works correctly.)
I believe you’re having a problem when it comes to releasing the Foms, where I may be missing?
My intention is that when you click on button3
had a reset
in the form, and the user starts from scratch.
You in the
OnClose
form is erasing itself, having recreated, and givingApplication.Run
again?– DH.
I believe not, when I say click on the close is the same window. I didn’t add any event to onclose
– Guilherme Lima
The code you showed is what’s in the
.dpr
then?– DH.
Exactly, I use it on a button.
– Guilherme Lima
What do you mean a button? Can you show more of the code? It’s too confusing for me yet.
– DH.
I’ll edit the question friend.
– Guilherme Lima
In which line does the problem happen?
– EMBarbosa