Logo Delphi Handbooks Collection

Delphi Developer Days 2012
March-May
Cantù-Jensen
(UK, NL, US, D, I)

Menu for Development

Site Menu
Delphi 2010 Handbook
Delphi 2009 Handbook
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)

Advertising
Home My Blog Handbooks Development Links Marco
Delphi Developer Days 2012


Home: Code Repository: Mastering Delphi 6

Chapter 03 - Project TextProp

Project Structure

TextProp.dpr
program TextProp;

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

{$R *.RES}

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

interface

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

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Button1: TButton;
    CheckBox1: TCheckBox;
    Label1: TLabel;
    Memo1: TMemo;
    ListBox1: TListBox;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

type
  TControlHack = class (TControl);

procedure TForm1.Button1Click(Sender: TObject);
var
  I: Integer;
begin
  for I := 0 to ControlCount - 1 do
    TControlHack (Controls [I]).Text :=
      TControlHack (Controls [I]).Text + '*';
end;

end.
TextPF.dfm
object Form1: TForm1
  Left = 200
  Top = 108
  Width = 434
  Height = 219
  Caption = 'TextProp'
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 168
    Top = 144
    Width = 32
    Height = 13
    Caption = 'Label1'
  end
  object Edit1: TEdit
    Left = 152
    Top = 76
    Width = 121
    Height = 21
    TabOrder = 0
    Text = 'Edit1'
  end
  object Button1: TButton
    Left = 152
    Top = 32
    Width = 121
    Height = 25
    Caption = 'Change Text'
    TabOrder = 1
    OnClick = Button1Click
  end
  object CheckBox1: TCheckBox
    Left = 152
    Top = 112
    Width = 121
    Height = 17
    Caption = 'CheckBox1'
    TabOrder = 2
  end
  object Memo1: TMemo
    Left = 280
    Top = 32
    Width = 137
    Height = 137
    Lines.Strings = (
      'Memo1')
    TabOrder = 3
  end
  object ListBox1: TListBox
    Left = 8
    Top = 32
    Width = 137
    Height = 137
    ItemHeight = 13
    Items.Strings = (
      'Item 1'
      'Item 2'
      'Item 3')
    TabOrder = 4
  end
end