unit MessageBox;

interface

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

type
  TForm1 = class(TForm)
    ListView1: TListView;
    ComboBox1: TComboBox;
    RadioGroup1: TRadioGroup;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

// BeginExample: MessageBox
// Method: Forms.TApplication.MessageBox
// Method: Forms.TApplication.NormalizeTopMosts
// Method: Forms.TApplication.RestoreTopMosts

// Warning: Is the MessageBox supposed to be on top of the objects in the form, or windows on the PC?

// BeginCode
{
The following code causes "stay on top" forms to allow a 
MessageBox to appear on top. After the message box is 
closed, the topmost forms are restored so that they continue
to float to the top.
}
procedure TForm1.Button1Click(Sender: TObject);
begin
  with Application do
  begin
    NormalizeTopMosts;
    MessageBox('This should be on top.', 'Look', MB_OK);    // [smbOK]
    RestoreTopMosts;
  end;
end;
// EndCode
// EndExample: MessageBox
end.
