Logo New book: Delphi 2007 Handbook
My blog in online
Delphi tech support service: support.marcocantu.com
Google
  Web www.marcocantu.com

Menu for Development

Site Menu
Delphi 2007 Handbook
Mastering Borland Delphi 2005
Essential Pascal
Essential Delphi
Buy Books Online
Code Repository
Newsgroups
White Papers
Tools
Conferences
Training
Delphi Links
Contact Marco

My Other Sites
Italian Site (www.marcocantu.it)
Developers Newsgroups Browser (dev.newswhat.com)
My town (www.piazzacavalli.net)
the delphi search
Wintech Italia (my company)

Breaking News
Buy Mastering Borland Delphi 2005 from Amazon
Free ebook: Mastering Delphi Update for Delphi 2006

Advertising
Home My Blog Books My Bookstore Development Links 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