unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    ComboBox1: TComboBox;
    ComboBox2: TComboBox;
    ComboBox3: TComboBox;
    Button1: TButton;
    Label1: TLabel;
    procedure ComboBox1Change(Sender: TObject);
    procedure ComboBox2Change(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    model,marka: integer;{ Public declarations }
  end;                //array[model,silniki]
  const silniki_fiat: array[0..2,0..1] of string=(('1.4 90KM','2.0JTD 165KM'),
                                                  ('1.1 54KM','1.3JTD 70KM'),
                                                  ('1.2 65KM','1.4T 105KM') );

        silniki_ford:array[0..2,0..1] of string= (('1.4 75KM','1.6 100KM'),
                                                   ('1.6 100KM','1.8TDCI 115KM'),
                                                   ('2.0TDCI 163KM','2.0 145KM'));

        silniki_subaru:array[0..2,0..1] of string=(('2.0 150KM','2.5T 230KM'),
                                                   ('2.0 150KM','2.0D 150KM'),
                                                   ('2.0 150KM','2.5T 265KM'));
var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
   Label1.Caption:=Combobox1.text+#13+Combobox2.Text+#13+combobox3.Text;
end;

procedure TForm1.ComboBox1Change(Sender: TObject);
begin
  Combobox2.Clear;
  Combobox2.Text:='Wybierz model';
  case Combobox1.ItemIndex of
  0:begin
      marka:=0; //fiat
      Combobox2.Items.Add('Bravo');
      Combobox2.Items.Add('Panda');
      Combobox2.Items.Add('Punto');
    end;
  1:begin
      marka:=1; //ford
      Combobox2.Items.Add('Fiesta');
      Combobox2.Items.Add('Focus');
      Combobox2.Items.Add('Mondeo');

    end;
  2:begin
      marka:=2; //subaru
      Combobox2.Items.Add('Forester');
      Combobox2.Items.Add('Impreza');
      Combobox2.Items.Add('Legacy');
    end;
  end;
end;

procedure TForm1.ComboBox2Change(Sender: TObject);
begin
  Combobox3.Clear;
  Combobox3.Text:='Wybierz silnik';
  model:=Combobox2.ItemIndex;
  case marka of
    0: begin
        Combobox3.Items.Add(silniki_fiat[model,0]); //silniki dla
        Combobox3.Items.Add(silniki_fiat[model,1]); //wybranego modelu fiata
       end;
    1: begin
        Combobox3.Items.Add(silniki_ford[model,0]); //silniki dla
        Combobox3.Items.Add(silniki_ford[model,1]); //wybranego modelu forda
       end;
    2: begin
        Combobox3.Items.Add(silniki_subaru[model,0]); //silniki dla
        Combobox3.Items.Add(silniki_subaru[model,1]); //wybranego modelu subaru
       end;
   end;
end;

end.
