Marco's Web Center

Menu for Development

Site Menu
Object Pascal Handbook
Delphi Handbooks Collection
Mastering Borland Delphi 2005
(Old) White Papers
(Old)Tools
(Old) Conferences

My Other Sites
Italian Site (www.marcocantu.it)
the delphi search

Spirit of delphi

Advertising
Home My Blog Books Object Pascal Marco

Home: Code Repository: Mastering Delphi 6

Chapter 09 - Project CreatOrd

Project Structure

CreatOrd.dpr
program CreatOrd;

uses
  Forms,
  CreateF in 'CreateF.pas' {Form1};

{$R *.RES}

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.
CreateF.pas
unit CreateF;

interface

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

type
  TForm1 = class(TForm)
    ListBox1: TListBox;
    procedure FormCreate(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure FormActivate(Sender: TObject);
  private
    ListBox2: TListBox;
  public
    constructor Create (AOwner: TComponent); override;
    procedure AfterConstruction; override;
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
  ListBox1.Items.Add ('OnCreate');

  ListBox2 := TListBox.Create (Self);
  ListBox2.Parent := Self;
  ListBox2.Align := alClient;
  ListBox2.Items.Add ('A first item');
end;

procedure TForm1.FormShow(Sender: TObject);
begin
  ListBox1.Items.Add ('OnShow');
end;

constructor TForm1.Create(AOwner: TComponent);
begin
  inherited Create (AOwner);

  ListBox1.Items.Add ('After inherited create');
  if Assigned (ListBox2) then
    ListBox2.Items.Add ('A second item');
end;

procedure TForm1.FormActivate(Sender: TObject);
begin
  ListBox1.Items.Add ('OnActivate');
end;

procedure TForm1.AfterConstruction;
begin
  inherited AfterConstruction;
  ListBox1.Items.Add ('After inherited AfterConstruction');
end;

end.
CreateF.dfm
object Form1: TForm1
  Left = 226
  Top = 206
  Width = 554
  Height = 416
  Caption = 'Create Order'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  OnActivate = FormActivate
  OnCreate = FormCreate
  OnShow = FormShow
  PixelsPerInch = 96
  TextHeight = 13
  object ListBox1: TListBox
    Left = 0
    Top = 0
    Width = 546
    Height = 193
    Align = alTop
    Color = clWindow
    ItemHeight = 13
    TabOrder = 0
  end
end