Autor Beitrag
-Nala-
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 62



BeitragVerfasst: Di 15.05.07 15:44 
hey Leute...

hab mal ne frage .

Ich versuche im moment eine digitale Uhr zu programmieren . Allerdings
komme ich nicht weiter .

ich habe 7 images erstellt und sie so angeordnet :

_
I I
-
I I
-

so wie eine acht .
dadurch kann man alle Zahlen darstellen .

ich habe einen timer erstellt und das interval auf 1000 gestellt .

ich schrieb in die prozedur das die acht zu einer 1 wird und es funktionierte.
NUn schrieb ich eine if abfrage hinein die, die 1 in eine 2 verwandelt aber die 8 verwandelte sich direkt in eine 2 und die 1 blieb weg .

ich bräuchte sowass wie einen satz mitdem man ausdrückt das die folgen der if abfrage erst starten sollen wenn 1 sekunde also ein interval vorbei ist .

sowas wie :

timer1.interval:=timer1.interval+1000;

könnt ihr mir helfen ?

THX
Leuchtturm
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1087

Win Vista, Knoppix, Ubuntu
Delphi 7 Pe, Turbo Delphi, C#(VS 2005 Express), (X)HTML + CSS, bald Assembler
BeitragVerfasst: Di 15.05.07 15:50 
wenn der Intervall des Timers 1000 ist, passiert das was in der Timer-Procedure steht nach jeder sekunde

_________________
Ich bin dafür verantwortlich was ich sage - nicht dafür was du verstehst.
-Nala- Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 62



BeitragVerfasst: Di 15.05.07 15:54 
nein .. es passiert irgendwie gleichzeitig .

hier is meine unit

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:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    ul: TImage;
    u: TImage;
    m: TImage;
    ol: TImage;
    ore: TImage;
    ur: TImage;
    o: TImage;
    t: TTimer;
    procedure FormCreate(Sender: TObject);
    procedure tTimer(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
o.Canvas.Brush.Color:=clblack;
o.Canvas.ellipse(-100,-100,100,120);

ore.Canvas.Brush.Color:=clblack;
ore.Canvas.ellipse(-100,-100,100,120);

ol.Canvas.Brush.Color:=clblack;
ol.Canvas.ellipse(-100,-100,100,120);

m.Canvas.Brush.Color:=clblack;
m.Canvas.ellipse(-100,-100,100,120);

ur.Canvas.Brush.Color:=clblack;
ur.Canvas.ellipse(-100,-100,100,120);

u.Canvas.Brush.Color:=clblack;
u.Canvas.ellipse(-100,-100,100,120);

ul.Canvas.Brush.Color:=clblack;
ul.Canvas.ellipse(-100,-100,100,120);
end;

procedure TForm1.tTimer(Sender: TObject);
begin
o.visible:=false;
ol.visible:=false;
ore.visible:=true;
m.visible:=false;
ul.visible:=false;
ur.visible:=true;
u.visible:=false;

if (o.visible=false  and
ol.visible=false      and
ore.visible=true      and
m.visible=false      and
ul.visible=false     and
ur.visible=true      and
u.visible=false)      then
begin
o.visible:=true;
ol.visible:=false;
ore.visible:=true;
m.visible:=true;
ul.visible:=true;
ur.visible:=false;
u.visible:=true;
end;
end;

end.



ich habe die Ellipsen gezeichnet um das image schwarz zu färben :D
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Di 15.05.07 18:06 
Logisch, der geht ja direkt in die if-Anweisung. Nimm eine globale Variable, die du von 0 auf 9 erhöhst und dann wieder auf 0 setzt. Dann kannst du prüfen, ob diese Variable = 0 ist und "0" anzeigen, etc.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Di 15.05.07 19:58 
ich würde sogar eine konstante deklarieren, ein 2 dimensionales array of Boolean. die erste dimension für die zählvariable, die zweite für das Visible des jeweiligen Images. Dann kannst du im Timer per
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
Image1.Visible:= MyArray[counter, 1];
Image2.Visible:= MyArray[counter, 2];
Image3.Visible:= MyArray[counter, 3];
{...}
if counter < 9 then
    inc(counter)
else
    counter := 0;

die Images sichtbar/unsichtbar machen. Zuvor definierst du noch den Array so, dass wenn ( bei MyArray[x,y] ) x = 1 ist, für y von 1 bis 7 die entsprechende Zahl raus kommt.
Scheint mir am sinnigsten zu sein ;)

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.