unit Befund2;

interface

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

type
  TForm1 = class(TForm)
    GroupBox1: TGroupBox;
    GroupBox2: TGroupBox;
    GroupBox3: TGroupBox;
    Button1: TButton;
    Button2: TButton;
    Edit1: TEdit;
    Panel1: TPanel;
    ScrollBar1: TScrollBar;
    procedure FormCreate(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure ScrollBar1Change(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

const
  DateiName = 'Diagnose.txt';
var
  Form1: TForm1;
  Diagnose: TStringList;
  Nr: Integer;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
  randomize;
  Diagnose := TStringList.Create;
  Diagnose.LoadFromFile (DateiName);
  ScrollBar1.Min := 0;
  ScrollBar1.Max := Diagnose.Count - 1;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Panel1.Caption := '';
  Edit1.Text := '';
  Edit1.SetFocus;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  Nr := random (Diagnose.Count);
  Panel1.Caption := Diagnose.Strings[Nr];
end;

procedure TForm1.ScrollBar1Change(Sender: TObject);
begin
  Panel1.Caption := Diagnose.Strings[ScrollBar1.Position];
end;

end.
