Autor Beitrag
Zlatan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 175



BeitragVerfasst: Di 22.02.11 17:55 
Ich habe hier einen Quelltext.
Das shape soll sich immer hin und her bewegen
DAs Problem ist: In welche Procedur schreibe ich diesen Quelltext ( das shape ist auf Form8)

FromShow ist wohl falsch
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
procedure TForm8.FormShow(Sender: TObject);
begin
AutomatikAus:=false;
repeat
shape1.Left:=shape1.Left +32;
Zeit.SetPause(50);
shape1.Left:=shape1.left +32;
Zeit.SetPause(50);
shape1.Left:=shape1.Left +32;
Zeit.SetPause(50);
shape1.Left:=shape1.Left -32;
Zeit.SetPause(50);
shape1.Left:=shape1.Left -32;
Zeit.SetPause(50);
shape1.Left:=shape1.Left -32;
Zeit.SetPause(50);
until AutomatikAus=true;
end;


Moderiert von user profile iconNarses: Titel geändert, war: "Quelltext korrekt aber...".
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19315
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Di 22.02.11 17:58 
Keine Ahnung was Zeit.SetPause ist, aber es sieht so aus als würdest du nach der Komponente TTimer suchen.
Zlatan Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 175



BeitragVerfasst: Di 22.02.11 18:00 
Zeit. setPAuse ist nicht das Problem(ist alles richtig [ist halt eine Pause])
DEr Text ist schon so wie er sein soll :)
ICh weiß nur nicht wohin mit dieser Prozedur

Es gibt ja soviele(FormCreate=geht nicht, FormShow=geht nicht .........)
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19315
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Di 22.02.11 18:07 
In gar keine, weil es so keinen Sinn macht, da so alles blockiert wird... nimm einfach einen Timer...
HenryHux
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 542
Erhaltene Danke: 33

Windows 7 Premium
Delphi XE, Eclipse
BeitragVerfasst: Di 22.02.11 18:08 
Wo ist denn genau das Problem?
Wenn du die Form öffnest, werden die Befehle in dem FormShow event abgearbeitet.
Du könntest ja mal testen, ob er überhaupt was macht, wenn du die Form startes, z.b mit showmessage('');
Zlatan Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 175



BeitragVerfasst: Di 22.02.11 18:09 
Wenn ich die Form öffne steht das shape an der Ausgangsposition
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19315
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Di 22.02.11 18:11 
FormShow wird direkt bevor das Formular angezeigt wird abgearbeitet. Deshalb siehst du davon auch nichts. Theoretisch kannst du das ins OnActivate schreiben, aber Sinn macht es trotzdem keinen. :roll: Ein Timer ist deutlich besser geeignet.
Zlatan Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 175



BeitragVerfasst: Di 22.02.11 18:22 
Funktionieren dann auch noch die anderen Prozeduren?
Irgendwie nicht
Zumindest bewegt sich das shape jetzt :roll:
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19315
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Di 22.02.11 18:27 
Ein Timer löst nur in einem bestimmten Abstand ein Ereignis aus (wie du ja sicher schon in der Hilfe gelesen hast... :roll:). Deshalb kannst du dir die Schleife dann sparen.
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Di 22.02.11 19:14 
Moin!

user profile iconjaenicke hat folgendes geschrieben Zum zitierten Posting springen:
aber Sinn macht es trotzdem keinen. :roll: Ein Timer ist deutlich besser geeignet.
Leider ist der Kollege hier relativ "Beratungsresistent"... Das hab ich auch schon mal alles erzählt... :roll:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.