Question

Which works better with opening a new form and closing an old one, form1.hide or form1.close?

On a buttonClick handler on Form1 I wrote:

Form1.Hide;
Form2.Show;

And then it gets stuck in a debugging session. (Only happened once -_-)

Then when I use

Form1.close;
Form2.Show;

All the forms close. Whats the difference between the two? (Other than .close actually closing everything xD)

Était-ce utile?

La solution

Hide simply sets Visible to false.

Close fires OnCloseQuery and OnClose events. If the form in question is the application's main form, the application will terminate. Depending on CloseAction the form will either Hide (CloseAction = caHide), Minimise (CloseAction = caMinimize) or free itself (CloseAction = caFree)

Your second question is unclear as to what you are trying to achieve.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top