unit ShowModal;

interface

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

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

var
  Form1: TForm1;

implementation

{$R *.dfm}

// BeginExample: ShowModal
// Property: Forms.TCustomForm.ModalResult
// Method: Forms.TCustomForm.ShowModal

// BeginCode
{
This code brings up the modal dialog from Unit2 when a
button is clicked.  It causes a Beep if the OK button is
clicked. Implement the modal form in Unit2 and then put
Unit2 in the uses clause for this module.
}
procedure TForm1.Button1Click(Sender: TObject);
begin
  if MyDialogBox1.ShowModal = mrOK then
    Beep;
end;
// EndCode
// EndExample: ShowModal
end.
