Delphi hiding a form: Is there a difference between Form.Hide and Form.Visible:=False?

Daisetsu picture Daisetsu · Mar 25, 2011 · Viewed 14.2k times · Source

I'm looking through two copies of code and in one I have myForm.Hide and another I have myForm.Visible := False. I can't remember why I changed this, if one was a bug fix or whether there is any difference at all.

Answer

David Heffernan picture David Heffernan · Mar 25, 2011

There is no difference for Hide. The VCL code is:

procedure TCustomForm.Hide;
begin
  Visible := False;
end;

But Show is a bit different:

procedure TCustomForm.Show;
begin
  Visible := True;
  BringToFront;
end;