unit BringToFront;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Unit2, StdCtrls;

type
  TForm1 = class(TForm)
    ShowPaletteButton: TButton;
    procedure ShowPaletteButtonClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

// BeginExample: BringToFront
// Property: Forms.TCustomForm.Visible
// Method: Controls.TControl.BringToFront

// BeginCode
{
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;
// EndCode
// EndExample: BringToFront
end.
