Den 22-02-04 20:04 skrev Theis følgende:
-----------------------------------------------------------------------------
Gør ikke så meget.
Klare mig...
-----------------------------------------------------------------------------
Nå, nu forstår jeg, kan godt gøre det
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, CheckLst, ExtCtrls, Menus;
type
TForm1 = class(TForm)
Edit7: TEdit;
Panel1: TPanel;
Panel2: TPanel;
Label1: TLabel;
Label3: TLabel;
Label4: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit8: TEdit;
Panel3: TPanel;
Label2: TLabel;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Label5: TLabel;
Label6: TLabel;
Edit9: TEdit;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Panel4: TPanel;
Panel5: TPanel;
Panel6: TPanel;
Button1: TButton;
Button2: TButton;
Label15: TLabel;
Button3: TButton;
Edit10: TEdit;
CheckListBox1: TCheckListBox;
Label16: TLabel;
Timer1: TTimer;
Timer2: TTimer;
Timer3: TTimer;
Timer4: TTimer;
Timer5: TTimer;
Label17: TLabel;
Label18: TLabel;
MainMenu1: TMainMenu;
Filer1: TMenuItem;
BegyndForfra1: TMenuItem;
Hjlp1: TMenuItem;
Ragler1: TMenuItem;
OmTerninger21: TMenuItem;
procedure Timer1Timer(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
procedure Timer3Timer(Sender: TObject);
procedure Timer4Timer(Sender: TObject);
procedure BegyndForfra1Click(Sender: TObject);
private
procedure Button1Click(Sender: TObject);
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Timer1Timer(Sender: TObject);
begin
randomize;
edit1.text := inttostr(random(6)+1);
edit2.text := inttostr(random(6)+1);
timer2.enabled := true;
edit7.Text := ' Terningerne ruller! ! ! ! !';
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
timer1.enabled := true;
end;
procedure TForm1.Timer2Timer(Sender: TObject);
var
S1, S2, S3, S4: integer;
begin
timer1.Enabled := false;
S1 := StrToInt(Edit1.Text);
S2 := StrToInt(Edit2.Text);
edit3.Text :=(IntToStr(S1+S2));
S3 := StrToInt(Edit3.Text);
S4 := StrToInt(Edit8.Text);
edit8.text := '';
edit8.Text :=(IntToStr(S3+S4));
timer3.Enabled := true;
timer2.Enabled := false;
end;
procedure TForm1.Timer3Timer(Sender: TObject);
begin
randomize;
edit4.text := inttostr(random(6)+1);
edit5.text := inttostr(random(6)+1);
edit7.text := ' Det er nu computerens tur:';
timer4.enabled := true;
end;
procedure TForm1.Timer4Timer(Sender: TObject);
var
S5, S6, S7, S8: integer;
begin
timer3.enabled := false;
edit7.text := '';
S5 := StrToInt(Edit4.Text);
S6 := StrToInt(Edit5.Text);
edit6.Text :=(IntToStr(S5+S6));
S7 := StrToInt(Edit6.Text);
S8 := StrToInt(Edit9.Text);
edit9.text := '';
edit9.Text :=(IntToStr(S7+S8));
timer4.enabled := false;
end;
procedure TForm1.BegyndForfra1Click(Sender: TObject);
begin
Button1Click(Sender: TObject);
end;
Tror det virker, men hvis det ikke gør så prøv at fjern (Sender: TObject)
i koden:
procedure TForm1.BegyndForfra1Click(Sender: TObject);
begin
Button1Click(Sender: TObject);
end;
Hvis det stadig ikke virker, så skriv fejlen, så kigger jeg på det
Mvh.
Kasper Nielsen