Autor Beitrag
ConditionZero
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 190

Win XP
Delphi 7 PE, C++ (Dev-C++), HTML+PHP (Dreamweaver MX), JavaScript(MS FrontPage)
BeitragVerfasst: Fr 17.11.06 14:28 
Tag zusammen,

Also die Sache ist folgende:
In einem Formular sind 5 verschiedene Bilder und per Knopfdruck soll das eine Bild unsichtbar werden und ein anderes Widerrum sichtbar.

Mein Code

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:
procedure TChooseForm.FormKeyPress(Sender: TObject; var Key: Char);
begin
x:=1;
  if Key = 't' then
  begin
  x:= x+1;
  end;

if Key = 'z' then
  begin
  x:= x-1;
  end;

end;

procedure TChooseForm.SwitchTimerTimer(Sender: TObject);
begin
if x = 1 then
  begin
  DavidImg.Visible:= true;
  MarkusImg.Visible:= false;
  MarcoImg.Visible:= false;
  end;

if x = 2 then
  begin
  MarkusImg.Visible:= true;
  DavidImg.Visible:= false;
  MarcoImg.Visible:= false;
  MarcImg.Visible:= false;
  SebiImg.Visible:= false;
  end;

if x = 3 then
  begin
  MarkusImg.Visible:= false;
  DavidImg.Visible:= false;
  MarcoImg.Visible:= true;
  MarcImg.Visible:= false;
  SebiImg.Visible:= false;
  end;

if x = 4 then
  begin
  MarkusImg.Visible:= false;
  DavidImg.Visible:= false;
  MarcoImg.Visible:= false;
  MarcImg.Visible:= true;
  SebiImg.Visible:= false;
  end;

if x = 5 then
  begin
  MarkusImg.Visible:= false;
  DavidImg.Visible:= false;
  MarcoImg.Visible:= false;
  MarcImg.Visible:= false;
  SebiImg.Visible:= true;
  end;

if x = 6 then
  begin
  x:= 1;
  end;

if x = -5 then
  begin
  x:= 5;
  end;

end;



Anmerkung: Das begin und end; bei den if-abfragen mach ich nur zur zusätzlichen übersicht über das Projekt.
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Fr 17.11.06 14:41 
Moin!

Und was ist jetzt deine Frage... ? :gruebel: ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Fr 17.11.06 14:42 
Aha, und was sollen wir jetzt tun? Oder habe ich die Frage übersehen? :gruebel:

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
ConditionZero Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 190

Win XP
Delphi 7 PE, C++ (Dev-C++), HTML+PHP (Dreamweaver MX), JavaScript(MS FrontPage)
BeitragVerfasst: Fr 17.11.06 14:54 
LoL,
ja sry hab mich nicht richtig artikuliert ;)

iwie geht das nicht da also wenn ich es teste und t drücke dann wechselt er einmal das bild, aber wenn ich dann z oder t drücke passiert gar nichts mehr. wisst hir woran das liegen könnte?
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Fr 17.11.06 15:02 
Moin!

Du mußt das hier:
ausblenden Delphi-Quelltext
1:
2:
3:
procedure TChooseForm.FormKeyPress(Sender: TObject; var Key: Char);  
begin  
x:=1;

ins FormCreate verschieben. ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
ConditionZero Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 190

Win XP
Delphi 7 PE, C++ (Dev-C++), HTML+PHP (Dreamweaver MX), JavaScript(MS FrontPage)
BeitragVerfasst: Fr 17.11.06 15:09 
ahh stimmt....^^ danke =)

jetzt hab ich aber ien anderes problem...
also musst dir des so vorstellen:

- - - - -

die stiche sind die fünf bilder eins ist immer nur sichtbar das man quasi auswählen kann welches bild da ist und wenn das bild ganz "rechtsa" angezeigt wird und man t drückt wird x nochmals um 1 erhöht dann soll eben das bild ganz links wieer angezeigt werden un andersrum auch aber da muss man jz 2-3x t bzw. z drücken damit das andere bild dann beim umschlag angezeigt wird. weißt du da weiter?


Edit: Ah ok hab den fehler gefunen, merce noch :)


LG Marc


Zuletzt bearbeitet von ConditionZero am Fr 17.11.06 15:13, insgesamt 1-mal bearbeitet
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Fr 17.11.06 15:12 
Moin!

Das sieht mir so aus, als könntest du damit was anfangen; geht da zwar um eine Ampel, aber das Prinzip (StateMachine) ist das gleiche. ;)

cu
Narses

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