unit Unit3;

interface

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

type
  TForm3 = class(TForm)
    Panel1: TPanel;
    Edit1: TEdit;
    Label1: TLabel;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Spin1: TSpinEdit;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Edit1KeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form3: TForm3;

implementation
uses unit1;
{$R *.DFM}

procedure TForm3.Button1Click(Sender: TObject);
begin
form1.ListBox1.Items.Insert(spin1.Value,form3.edit1.Text);
form3.Edit1.Clear;
form3.Close;
end;

procedure TForm3.FormCreate(Sender: TObject);
begin
spin1.Value:=form1.ListBox1.ItemIndex+1;
end;

procedure TForm3.Button2Click(Sender: TObject);
begin
form1.ListBox1.items.insert(spin1.Value,form3.edit1.Text);
form3.Edit1.Clear;

end;

procedure TForm3.Button3Click(Sender: TObject);
begin
edit1.Clear;
form3.Close;

end;

procedure TForm3.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if key = #13 then Button2Click(nil);
end;

end.
