Autor Beitrag
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Mi 11.10.06 14:40 
Du musst deinen Integer Typen natürlich zuerst in einen String umwandeln!
ausblenden Delphi-Quelltext
1:
 label1.caption := IntToStr(Zahl);					

Am besten ließt du dir aber erstmal den Delphi-Crashkurs durch ;)


Zuletzt bearbeitet von Marc. am Mi 11.10.06 14:41, insgesamt 2-mal bearbeitet
Xion
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
EE-Maler
Beiträge: 1952
Erhaltene Danke: 128

Windows XP
Delphi (2005, SmartInspect), SQL, Lua, Java (Eclipse), C++ (Visual Studio 2010, Qt Creator), Python (Blender), Prolog (SWIProlog), Haskell (ghci)
BeitragVerfasst: Mi 11.10.06 14:41 
2 timer ist meinermeinung nach quatsch. Wenn du die eine Zeile vom 2ten Timer in den ersten ans Ende kopierst ist das genau das selbe.

_________________
a broken heart is like a broken window - it'll never heal
In einem gut regierten Land ist Armut eine Schande, in einem schlecht regierten Reichtum. (Konfuzius)
Makavelithadon Threadstarter
Hält's aus hier
Beiträge: 13



BeitragVerfasst: Mi 11.10.06 14:44 
Kann mir jez plz nochmal einer nen quelltext schiggn ich bin grad verwirrt^^
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Mi 11.10.06 14:45 
schau mal auf seite eins da hab ich dir was angehängt...

ausblenden volle Höhe Delphi-Quelltext
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:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    Label1: TLabel;
    Label2: TLabel;
    Timer1: TTimer;
    procedure Button1Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;
  zeit: integer = 10;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
 zeit:= 10;
 label1.caption:= inttostr(zeit);
 timer1.enabled:= true;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
 dec(zeit);
 if zeit < 1 then
 begin
  label2.Caption:= 'BOOM';
  timer1.Enabled:= false;
 end
 else
  label2.caption:= inttostr(zeit);
end;

end.

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.
AndyM79
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 20

Win XP Prof.
Delphi 5 Prof. & BDS 2006
BeitragVerfasst: Mi 18.10.06 08:23 
Hallo,
das Thema läuft zwar schon ne Weile, aber ich hatte ein ähnliches Problem und hab mir da einfach mal ein eigenes Formular gebastelt.
Formular in Projekt einbinden und einfach Aufrufen. Es geht dann ein Fenster auf und der Countdown läuft ab, solng ist die Applikation gesperrt.
Ich fand die Lösung recht elegant.

Dateien des Countdown Formulars und Bild des Fensters im Anhang.
und so wird der Countdown gestartet:

**Code**
procedure TForm1.Button1Click(Sender: TObject);
begin
with TCountdown.Create(nil) do
try
StartCountdown(1);//Zeit Countdown in Minunten, läßt sich aber auch in Sekunden umbauen
finally
Free;
end;
end;
****

Vielleicht kann es ja jemand gebrauchen.

Gruß aus dem schönen Westerwald
Andy
Einloggen, um Attachments anzusehen!
Raezor
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 54

Status:
Administrator des Mondes
BeitragVerfasst: Mo 12.03.07 18:43 
wie kann ich machen, das neben den start button ein feld ist, zum eintragen, ab wo der timer zählt?
Also so, dass man die Zeit, die runterzählt selbst einstellen kann?

ich bezihe mich auf den code:
www.delphi-forum.de/download.php?id=4514
Raezor
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 54

Status:
Administrator des Mondes
BeitragVerfasst: Di 13.03.07 21:37 
seit nicht so, teilt euer wissen mit mir^^
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Di 13.03.07 21:44 
Das sollte nun wirklich nicht zu schwer sein.
Was du brauchst ist ein Editfeld. Aus diesem Editfeld liest du deinen Startwert aus und ersetzt ihn mit der "10", die zur Zeit noch in deinem Quellcode steht.;)

grüße
Raezor
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 54

Status:
Administrator des Mondes
BeitragVerfasst: Mi 14.03.07 15:07 
und das geht, indem man welchen code benutzt?
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Mi 14.03.07 15:21 
Hallo!

Angenommen du hast ein Edit, einen Button und einen Timer auf deinem Formular!

Deklarier eine globale Variable: counter: integer;

Einstellungen: Edit = deine Zahl
Timer = Intervall auf 1000 (1 Sekunde)

Timer ist deaktiviert (enabled = false)

Bei Button-Klick:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
  //Initialisierung
  counter:= 0;
  //Countdown starten
  Timer.Enabled:= true;


Im Timer-Ereignis deines Timers:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
  //Eins raufsetzen
  inc(counter);
  //einfach mal ausgeben
  caption:= inttostr(edit.text - counter);
  //Prüfen ob Countdown erreicht
  if counter >= strtoint(edit.text) then
  begin
   //Countdown ist abgelaufen
  end;


Hoffe es ist verständlich!

LG
Stefan

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.
Raezor
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 54

Status:
Administrator des Mondes
BeitragVerfasst: Mi 14.03.07 16:09 
Irgendwie nicht.^^

mein quellentext:

ausblenden volle Höhe Delphi-Quelltext
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:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Timer1: TTimer;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Timer2: TTimer;
    Panel1: TPanel;
    Label2: TLabel;
    Edit1: TEdit;
    procedure Button1Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure Timer2Timer(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Timer3Timer(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;
  zeit: integer = 100;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
zeit:= 11;
 timer1.enabled:= true;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
 dec(zeit);
            windows.Beep(1000,200);
 if zeit < 0 then
 begin
  label2.Caption:= '00';
           windows.Beep(800,200);
  windows.Beep(400,2000);

  close;
 end
 else
  label2.caption:= inttostr(zeit);
end;

procedure TForm1.Timer2Timer(Sender: TObject);
begin
zeit:= 60;
windows.Beep(2000,2000);
 timer1.enabled:= false;
 timer2.enabled:= false;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin

 Form1.Brush.Style:=bsClear;
  Form1.BorderStyle:=bsNone;
end;

procedure TForm1.Timer3Timer(Sender: TObject);
begin
inc(zeit);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
zeit:= 31;
 timer1.enabled:= true;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
zeit:= 8;
 timer1.enabled:= true;

end;

end.


Wie also?

Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt
Raezor
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 54

Status:
Administrator des Mondes
BeitragVerfasst: Do 15.03.07 20:24 
bitte helft mir doch.
Ich komme nicht ganz zurecht.
Versuche schon mit
ausblenden Quelltext
1:
zeit:= (Edit1.Text);					

, doch es geht nicht
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Do 15.03.07 20:51 
Hallo!

1. Wenn Zeit vom Typ Integer ist (was ich annehme) musst du zeit:= strtoint(edit1.text) schreiben, weil Integer und String nicht kompatibel sind.

2. Wenn man sich die vorherigen Beiträge durchliest und die Suchfunktion im Forum benutzt, kommt man irgendwann auch dahinter.

3. Im Anhang!

LG
Stefan
Einloggen, um Attachments anzusehen!
_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.
Raezor
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 54

Status:
Administrator des Mondes
BeitragVerfasst: Do 15.03.07 22:04 
Vielen dank, Geist der Zeit, es funktioniert
mit strtoint