Chapter 09 - Project QMultiWin |
Project Structure
|
QMultiWin.dpr |
program QMultiWin;
uses
QForms,
MainForm in 'MainForm.pas' ,
MWForm2 in 'MWForm2.pas' ,
MWForm3 in 'MWForm3.pas' ,
MWForm4 in 'MWForm4.pas' ;
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TForm4, Form4);
Application.Run;
end.
|
MainForm.pas |
unit MainForm;
interface
uses
Qt, SysUtils, Classes, QGraphics, QControls, QForms, QDialogs,
QStdCtrls;
type
TForm1 = class(TForm)
btnMultiple: TButton;
btnSingle: TButton;
btnModal: TButton;
procedure btnSingleClick(Sender: TObject);
procedure btnMultipleClick(Sender: TObject);
procedure btnModalClick(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
uses
MWForm2, MWForm3, MWForm4;
procedure TForm1.btnSingleClick(Sender: TObject);
begin
if not Assigned (Form2) then
Form2 := TForm2.Create (Application);
Form2.Show;
end;
procedure TForm1.btnMultipleClick(Sender: TObject);
begin
with TForm3.Create (Application) do
Show;
end;
procedure TForm1.btnModalClick(Sender: TObject);
var
Modal: TForm4;
begin
Modal := TForm4.Create (Application);
try
Modal.ShowModal;
finally
Modal.Free;
end;
end;
end.
|
MWForm2.pas |
unit MWForm2;
interface
uses
Qt, SysUtils, Classes, QGraphics, QControls, QForms, QDialogs;
type
TForm2 = class(TForm)
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
public
end;
var
Form2: TForm2;
implementation
procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caFree;
Form2 := nil;
end;
end.
|
MWForm3.pas |
unit MWForm3;
interface
uses
Qt, SysUtils, Classes, QGraphics, QControls, QForms, QDialogs;
type
TForm3 = class(TForm)
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
public
end;
implementation
procedure TForm3.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caFree;
end;
end.
|
MWForm4.pas |
unit MWForm4;
interface
uses
Qt, SysUtils, Classes, QGraphics, QControls, QForms, QDialogs;
type
TForm4 = class(TForm)
private
public
end;
var
Form4: TForm4;
implementation
end.
|
MainForm.xfm |
object Form1: TForm1
Left = 192
Top = 107
Width = 167
Height = 181
VertScrollBar.Range = 121
HorzScrollBar.Range = 115
ActiveControl = btnMultiple
Caption = 'MultiWin'
Color = clButton
Font.Color = clText
Font.Height = 11
Font.Name = 'MS Sans Serif'
Font.Pitch = fpVariable
Font.Style = []
Font.Weight = 40
ParentFont = False
PixelsPerInch = 96
TextHeight = 13
TextWidth = 6
object btnMultiple: TButton
Left = 40
Top = 16
Width = 75
Height = 25
Caption = 'Multiple'
TabOrder = 0
OnClick = btnMultipleClick
end
object btnSingle: TButton
Left = 40
Top = 96
Width = 75
Height = 25
Caption = 'Single'
TabOrder = 1
OnClick = btnSingleClick
end
object btnModal: TButton
Left = 40
Top = 56
Width = 75
Height = 25
Caption = 'Modal'
TabOrder = 2
OnClick = btnModalClick
end
end
|
MWForm2.xfm |
object Form2: TForm2
Left = 389
Top = 105
Width = 291
Height = 180
Caption = 'Form2'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
OnClose = FormClose
PixelsPerInch = 96
TextHeight = 13
end
|
MWForm3.xfm |
object Form3: TForm3
Left = 209
Top = 259
Width = 290
Height = 180
Caption = 'Form3'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
Position = poDefaultPosOnly
OnClose = FormClose
PixelsPerInch = 96
TextHeight = 13
end
|
MWForm4.xfm |
object Form4: TForm4
Left = 342
Top = 344
Width = 279
Height = 203
Caption = 'Form4'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
end
|