RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomActiveForm.Visible Property

Indicates whether the form is visible.

Pascal
property Visible: Boolean;
C++
__property Boolean Visible;

Use Visible to determine whether the form is visible. 

If Visible is true, the form is visible unless it is completely obscured by other forms. If Visible is false, the form is not visible. 

The Show and ShowModal methods set Visible to true and bring the form to the front of all open windows.  

C++ Examples: 

 

/*
The following code uses two forms. Form1 has a button on it. The
second form is used as a tool palette. This code makes the palette
form visible, and ensures it is the top form by bringing it to the
front.  To run this example, you must include Unit2.h in this
module.
*/
#include "Unit2.h"

void __fastcall TForm1::ShowPaletteButtonClick(TObject *Sender)
{
  if (!Form2->Visible)
  {
    Form2->Visible = true;
    Form2->BringToFront();
  }
}

 

Delphi Examples: 

{
The following code uses two forms. Form1 has a button on it. The
second form is used as a tool palette. This code makes the palette
form visible, and ensures it is the top form by bringing it to the
front.  To run this example, you must add Unit2 in the uses clause
of your unit.
} 
procedure TForm1.ShowPaletteButtonClick(Sender: TObject);
begin
if Form2.Visible = False then Form2.Visible := True;
Form2.BringToFront;
end;

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!