// начало кода

unit genres;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, Buttons, StdCtrls, dm;

type

TForm3 = class(TForm)

ListBox1: TListBox;

Button1: TButton;

Button2: TButton;

BitBtn1: TBitBtn;

BitBtn2: TBitBtn;

Button3: TButton;

Button4: TButton;

ListBox2: TListBox;

ComboBox1: TComboBox;

procedure FormCreate(Sender: TObject);

procedure Button1Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

procedure ComboBox1Change(Sender: TObject);

procedure Button3Click(Sender: TObject);

procedure Button4Click(Sender: TObject);

procedure ListBox2DblClick(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form3: TForm3;

implementation

{$R *.dfm}

procedure TForm3.FormCreate(Sender: TObject);

var

i: integer;

begin

for i:= 0 to maxg do

ListBox2.Items.Add(gg[i][2]);

ListBox2.ItemIndex:= 0;

end;

procedure TForm3.Button1Click(Sender: TObject);

var

i: integer;

begin

for i:= 0 to ListBox1.Items.Count – 1 do

if ListBox2.Items[ListBox2.ItemIndex] = ListBox1.Items[i]

then exit;

ListBox1.Items.Add(ListBox2.Items[ListBox2.ItemIndex]);

end;

procedure TForm3.Button2Click(Sender: TObject);

begin

if ListBox1.ItemIndex = –1 then exit;

ListBox1.Items.Delete(ListBox1.ItemIndex);

end;

procedure TForm3.ComboBox1Change(Sender: TObject);

begin

ListBox2.ItemIndex:= LI[ComboBox1.ItemIndex];

ListBox2.TopIndex:= ListBox2.ItemIndex;

end;

procedure TForm3.Button3Click(Sender: TObject);

var

k: integer;

begin

k:= ListBox1.ItemIndex;

if k > 0 then

begin

ListBox1.Items.Move(k,k-1);

ListBox1.ItemIndex:= k –1;

end;

end;

procedure TForm3.Button4Click(Sender: TObject);

var

k: integer;

begin

k:= ListBox1.ItemIndex;

if k < ListBox1.Items.Count – 1 then

begin

ListBox1.Items.Move(k,k+1);

ListBox1.ItemIndex:= k+1;

end;

end;

procedure TForm3.ListBox2DblClick(Sender: TObject);

begin

Button1Click(nil);

end;

end.

// конец кода