FormStyle (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example ensures that the main form of the application is an MDI parent.

Code

type
  TForm1 = class(TForm)
    Edit1: TEdit;
  private
    { Private declarations }
  public
    { Public declarations }
    constructor Create(AOwner : TComponent); override;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

constructor TForm1.Create(AOwner : TComponent);

begin
  inherited Create(AOwner);
  if FormStyle <> fsMDIForm then
    	  FormStyle := fsMDIForm;
  if FormStyle = fsMDIForm then
    	  Edit1.Text := 'MDI form'
  else
    //This line never executes
    Edit1.Text := 'Not an MDI form';
end;

Uses