unit Sprechstunde;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Menus;
type
TForm1 =
class(TForm)
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
GroupBox3: TGroupBox;
Button1: TButton;
Button2: TButton;
Edit1: TEdit;
Panel1: TPanel;
ScrollBar1: TScrollBar;
MainMenu1: TMainMenu;
Datei1: TMenuItem;
Oeffnen1: TMenuItem;
Speichern1: TMenuItem;
Drucken1: TMenuItem;
Ende1: TMenuItem;
OpenDialog1: TOpenDialog;
SaveDialog1: TSaveDialog;
procedure FormCreate(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure ScrollBar1Change(Sender: TObject);
procedure Oeffnen1Click(Sender: TObject);
procedure Speichern1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
const
Max = 10;
var
Form1: TForm1;
Diagnose:
Array[1..Max]
of String;
Nr: Integer;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
randomize;
Diagnose[1] := '
Him...';
Diagnose[2] := '
Das ist ein Ding!';
Diagnose[3] := '
Siehmal an!';
Diagnose[4] := '
Was soll ich sagen?';
Diagnose[5] := '
Tatsächlich?';
Diagnose[6] := '
So geht es dir aso.';
Diagnose[7] := '
Du hast Probleme.';
Diagnose[8] := '
Das kann ich verstehen.';
Diagnose[9] := '
Ich bin Sprachlos';
Diagnose[10]:= '
Na Ja...';
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Nr := random (Max) + 1;
Panel1.Caption := Diagnose[Nr];
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Panel1.Caption := '
';
Edit1.Text := '
';
Edit1.SetFocus;
end;
procedure TForm1.ScrollBar1Change(Sender: TObject);
begin
Panel1.Caption := Diagnose[ScrollBar1.Position];
ScrollBar1.Min := 1;
ScrollBar1.Max := Max;
end;
procedure TForm1.Oeffnen1Click(Sender: TObject);
begin
try
if OpenDialog1.Execute
then
Diagnose.LoadFromFile(OpenDialog1.FileName);
ScrollBar1.Max = Diagnose.Count - 1;
except
ShowMessage ('
Fehler beim Öffnen der Datei!');
end;
end;
procedure TForm1.Speichern1Click(Sender: TObject);
begin
try
if SaveDialog1.Execute
then
Psycho.SaveToFile (SaveDialog1.FileName);
except
ShowMessage ('
Fehler beim Speichern der Datei!');
end;
end.