Marco Web Center

[an error occurred while processing this directive]

Home: Code Repository: Mastering Delphi 6

Chapter 06 - Project QLibComp

Project Structure

QLibComp.dpr
program QLibComp;

uses
  QForms,
  QLibCompForm in 'QLibCompForm.pas' {Form1};

{$R *.res}

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

interface

uses
  SysUtils, Types, Classes, QGraphics, QControls, QForms, QDialogs,
  QStdCtrls;

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

var
  Form1: TForm1;

implementation

{$R *.xfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  ListBox1.Items.add (Edit1.Text);
end;

end.
QLibCompForm.xfm
object Form1: TForm1
  Left = 192
  Top = 107
  Width = 350
  Height = 210
  VertScrollBar.Range = 161
  HorzScrollBar.Range = 297
  ActiveControl = Button1
  Caption = 'QLibComp'
  Color = clBackground
  PixelsPerInch = 96
  TextHeight = 13
  TextWidth = 6
  object Button1: TButton
    Left = 56
    Top = 64
    Width = 75
    Height = 25
    Caption = 'Add'
    TabOrder = 0
    OnClick = Button1Click
  end
  object Edit1: TEdit
    Left = 40
    Top = 32
    Width = 105
    Height = 21
    TabOrder = 1
    Text = 'my name'
  end
  object ListBox1: TListBox
    Left = 176
    Top = 32
    Width = 121
    Height = 129
    Items.Strings = (
      'marco'
      'john'
      'helen')
    Rows = 3
    TabOrder = 2
  end
end