summaryrefslogtreecommitdiff
path: root/unit4.pas
blob: 8d11c99afd5bf8e3bf2fef52f01aa6ab11b802e3 (plain)
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
unit Unit4;

{$mode objfpc}{$H+}

interface

uses
  Classes,SysUtils,FileUtil,Forms,Controls,Graphics,Dialogs,StdCtrls,unit2;

type

  { TForm3 }

  TForm3 = class(TForm)
    ListBox1: TListBox;
    ListBox2: TListBox;
    ListBox3: TListBox;
    Memo1: TMemo;
    procedure FormDestroy(Sender: TObject);
    procedure FormResize(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure ListBox1Click(Sender: TObject);
    procedure Memo1Change(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
    loesung:   tLoesung;
    tmpInhalt: array of tStringList;
  end;

var
  Form3: TForm3;

implementation

{$R *.lfm}

{ TForm3 }

procedure TForm3.FormResize(Sender: TObject);
begin
  listBox1.height:=form3.clientHeight-listBox1.top;
  listBox1.width:=(form3.clientWidth-listBox1.left-12) div 4;
  listBox2.height:=form3.clientHeight-listBox2.top;
  listBox2.left:=listBox1.left+listBox1.width+4;
  listBox2.width:=(form3.clientWidth-listBox2.left-8) div 3;
  memo1.height:=form3.clientHeight-memo1.top;
  memo1.left:=listBox2.left+listBox2.width+4;
  memo1.width:=(form3.clientWidth-memo1.left-4) div 2;
  listBox3.height:=form3.clientHeight-listBox3.top;
  listBox3.left:=memo1.left+memo1.width+4;
  listBox3.width:=form3.clientWidth-listBox3.left;
end;

procedure TForm3.FormDestroy(Sender: TObject);
var
  i: longint;
begin
  loesung.free;
  for i:=0 to length(tmpInhalt)-1 do
    tmpInhalt[i].free;
  setlength(tmpInhalt,0);
end;

procedure TForm3.FormShow(Sender: TObject);
var
  i: longint;
begin
  loesung.filterUebersicht(listBox1.items);
  for i:=0 to length(tmpInhalt)-1 do
    tmpInhalt[i].free;
  setlength(tmpInhalt,listBox1.items.count);
  for i:=0 to length(tmpInhalt)-1 do
    tmpInhalt[i]:=nil;
  listBox2.items.clear;
  listBox3.items.clear;
  memo1.lines.clear;
end;

procedure TForm3.ListBox1Click(Sender: TObject);
begin
  if (listBox1.itemIndex>=0) and
     (listBox1.itemIndex<length(loesung.filter)) then begin
    loesung.filter[listBox1.itemIndex].sortenreinAnzeigen(listBox3.items,listBox2.items);
    if tmpInhalt[listBox1.itemIndex]=nil then begin
      tmpInhalt[listBox1.itemIndex]:=tStringList.create;
      tmpInhalt[listBox1.itemIndex].text:=listBox2.items.text;
    end;
    memo1.lines.text:=tmpInhalt[listBox1.itemIndex].text;
  end;
end;

procedure TForm3.Memo1Change(Sender: TObject);
begin
  tmpInhalt[listBox1.itemIndex].text:=memo1.lines.text;
  loesung.filter[listBox1.itemIndex].findeRsZuAnderenCs(memo1.lines,listBox3.items);
end;

end.