unit main;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, ExtCtrls,
  StdCtrls, Buttons;

type

  { TForm1 }

  TForm1 = class ( TForm )
    buSteuerung : TButton;
    buStopp : TButton;
    txZeit : TEdit;
    txRichtig : TEdit;
    txFalsch : TEdit;
    txNoch : TEdit;
    Label4 : TLabel;
    Label5 : TLabel;
    Label6 : TLabel;
    Label7 : TLabel;
    txAnzahl : TEdit;
    Label3 : TLabel;
    txAufgabe : TEdit;
    txAntwort : TEdit;
    Label1 : TLabel;
    Label2 : TLabel;
    Timer : TTimer;
    procedure buSteuerungClick ( Sender : TObject ) ;
    procedure TimerTimer ( Sender : TObject ) ;
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  Form1 : TForm1;

implementation

{ TForm1 }


procedure TForm1.TimerTimer ( Sender : TObject ) ;
begin
  txZeit.text := IntToStr(StrToInt(txZeit.text) + 1)
end;


procedure TForm1.buSteuerungClick ( Sender : TObject ) ;
begin
     if buSteuerung.Caption = 'Start' then
     Begin
          buSteuerung.Caption := 'Pause';
          txZeit.Text := IntToStr(0);
          txRichtig.Text := IntToStr(0);
          txFalsch.Text :=  IntToStr(0);
          txNoch.Text :=  txAnzahl.Text;
          Timer.Enabled := True;
          Randomize;
          AufgabeStellen
     End
     Else if  buSteuerung.Caption = 'Pause' then
     Begin
          buSteuerung.Caption := 'Weiter';
          Timer.Enabled := False;
          txAufgabe.Text := '';
          txAntwort.Text := ''
     End
     Else
     Begin
          buSteuerung.Caption := 'Pause';
          Timer.Enabled := True;
          AufgabeStellen
     End
  
end;

procedure AufgabeStellen;
var
   Faktor1, Faktor2 : Integer;
begin
     Faktor1 := Random(9);
     Faktor2 := Random(9);
     Form1.txAufgabe.Text := IntToStr(Faktor1) + ' x ' + IntToStr(Faktor2)
end;


initialization
  {$I main.lrs}
end.

