1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143:
| 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; procedure ComboBox1Change(Sender: TObject); procedure ComboBox2Change(Sender: TObject); procedure FillMyArray; procedure Button1Click(Sender: TObject); private Array1: array[0..2] of string; Array2: array[0..2, 0..2] of string; MyArray: array[0..2, 0..2, 0..2] of string; public end;
var Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.ComboBox1Change(Sender: TObject); var i: Integer; begin if ComboBox1.ItemIndex > -1 then begin ComboBox2.Clear; ComboBox3.Clear; for i := 0 to 2 do ComboBox2.Items.Add(Array2[ComboBox1.ItemIndex, i]); end; end;
procedure TForm1.ComboBox2Change(Sender: TObject); var i: Integer; begin if (ComboBox1.ItemIndex > -1) and (ComboBox2.ItemIndex > -1)then begin ComboBox3.Clear; for i := 0 to 2 do ComboBox3.Items.Add(MyArray[ComboBox1.ItemIndex, ComboBox2.ItemIndex, i]); end; end;
procedure TForm1.FillMyArray; begin
Array1[0] := 'Pflanzen'; Array1[1] := 'Menschen'; Array1[2] := 'Tiere';
Array2[0, 0] := 'Sträucher'; Array2[0, 1] := 'Bäume'; Array2[0, 2] := 'Blumen';
Array2[1, 0] := 'Mann'; Array2[1, 1] := 'Frau'; Array2[1, 2] := 'Kind';
Array2[2, 0] := 'Flugtiere'; Array2[2, 1] := 'Wassertiere'; Array2[2, 2] := 'Landtiere';
MyArray[0, 0, 0] := 'Brombeere'; MyArray[0, 0, 1] := 'Heidelbeere'; MyArray[0, 0, 2] := 'Stachelbeere';
MyArray[0, 1, 0] := 'Eiche'; MyArray[0, 1, 1] := 'Buche'; MyArray[0, 1, 2] := 'Linde';
MyArray[0, 2, 0] := 'Rose'; MyArray[0, 2, 1] := 'Tulpe'; MyArray[0, 2, 2] := 'Lilie';
MyArray[1, 0, 0] := 'Bernd'; MyArray[1, 0, 1] := 'Uwe'; MyArray[1, 0, 2] := 'Kai';
MyArray[1, 1, 0] := 'Angela'; MyArray[1, 1, 1] := 'Michaela'; MyArray[1, 1, 2] := 'Susanne';
MyArray[1, 2, 0] := 'Kind1'; MyArray[1, 2, 1] := 'Kind2'; MyArray[1, 2, 2] := 'Kind3';
MyArray[2, 0, 0] := 'Taube'; MyArray[2, 0, 1] := 'Spatz'; MyArray[2, 0, 2] := 'Geier';
MyArray[2, 1, 0] := 'Rochen'; MyArray[2, 1, 1] := 'Forelle'; MyArray[2, 1, 2] := 'Hecht';
MyArray[2, 2, 0] := 'Hund'; MyArray[2, 2, 1] := 'Katze'; MyArray[2, 2, 2] := 'Maus';
end;
procedure TForm1.Button1Click(Sender: TObject); var i: Integer; begin FillMyArray; ComboBox1.Clear; for i := 0 to 2 do ComboBox1.Items.Add(Array1[i]); end;
end. |