Marco Web Center

[an error occurred while processing this directive]

Home: Code Repository: Mastering Delphi 6

Chapter 09 - Project QBorders

Project Structure

QBorders.dpr
program QBorders;

uses
  QForms,
  BordersF in 'BordersF.pas' {Form1},
  Second in 'Second.pas' {Form2};

{$R *.res}

begin
  Application.CreateForm(TForm1, Form1);
  Application.CreateForm(TForm2, Form2);
  Application.Run;
end.
BordersF.pas
unit BordersF;

interface

uses
  SysUtils, Qt, Classes, QGraphics, QControls, QForms, QDialogs,
  QStdCtrls, QExtCtrls;

type
  TForm1 = class(TForm)
    BtnNewForm: TButton;
    BorderRadioGroup: TRadioGroup;
    procedure BtnNewFormClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.xfm}

uses
  Second;

procedure TForm1.BtnNewFormClick(Sender: TObject);
var
  NewForm: TForm2;
begin
  NewForm := TForm2.Create (Application);
  NewForm.BorderStyle := TFormBorderStyle (
    BorderRadioGroup.ItemIndex);
  NewForm.Caption := BorderRadioGroup.Items[
    BorderRadioGroup.ItemIndex];
  NewForm.Show;
end;

end.
Second.pas
unit Second;

interface

uses
  SysUtils, Qt, Classes, QGraphics, QControls, QForms, QDialogs;

type
  TForm2 = class(TForm)
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.xfm}

end.
BordersF.xfm
object Form1: TForm1
  Left = 210
  Top = 103
  Width = 291
  Height = 182
  VertScrollBar.Range = 169
  HorzScrollBar.Range = 267
  ActiveControl = BtnNewForm
  Caption = 'Borders'
  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 BtnNewForm: TButton
    Left = 192
    Top = 16
    Width = 75
    Height = 25
    Caption = 'New Form'
    TabOrder = 0
    OnClick = BtnNewFormClick
  end
  object BorderRadioGroup: TRadioGroup
    Left = 8
    Top = 8
    Width = 169
    Height = 161
    Items.Strings = (
      'None'
      'Single'
      'Sizeable'
      'Dialog'
      'Tool Window'
      'Sizeable Tool Window')
    Caption = ' Border '
    ItemIndex = 0
    TabOrder = 1
  end
end
Second.xfm
object Form2: TForm2
  Left = 210
  Top = 144
  Width = 250
  Height = 100
  Caption = 'Form2'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = True
  Position = poDefaultPosOnly
  PixelsPerInch = 96
  TextHeight = 13
end