Autor Beitrag
CrOc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 48

Win XP
D5 Standard
BeitragVerfasst: Do 15.01.04 19:48 
hi,
ich hab mir ein panel erstellt und eine onkeydown anweisung programmiert, die das panel selbstständig in die Richtung der gedrückten Pfeiltasten bewegen soll:

ausblenden 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:
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
var
 zufall: integer;
begin

if key = vk_right then
  repeat
   panel1.left:= panel1.left + 5;
  until (panel1.left < 564) or (key = vk_left) or (key = vk_up) or (key = vk_down);

 if key = vk_left then
  repeat
   panel1.left:= panel1.left - 5;
  until (panel1.left > 1) or (key = vk_right) or (key = vk_up) or (key = vk_down);

 if key = vk_up then
  repeat
   panel1.top:= panel1.top - 5;
  until (panel1.top > 1) or (key = vk_left) or (key = vk_right) or (key = vk_down);

 if key = vk_down then
  repeat
   panel1.top:= panel1.top + 5
  until (panel1.top < 324) or (key = vk_up) or (key = vk_left) or (key = vk_right);

end;



Aber irgendwie will sich das panel nicht selbstständig bewegen. was nu?

Moderiert von user profile iconPeter Lustig: Code- durch Delphi-Tags ersetzt
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: Do 15.01.04 19:59 
Hi,

Ist KeyPreview der Form auf True?
CrOc Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 48

Win XP
D5 Standard
BeitragVerfasst: Do 15.01.04 20:02 
sorry,
aber ich versteht nicht so ganz was du meinst.
was is keypreview
Lhid
ontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 831



BeitragVerfasst: Do 15.01.04 20:02 
Meinung und mich grundlegend verändert.--> Beiträge gelöscht


Zuletzt bearbeitet von Lhid am Sa 26.09.09 10:20, insgesamt 1-mal bearbeitet
CrOc Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 48

Win XP
D5 Standard
BeitragVerfasst: Do 15.01.04 20:05 
sorry,
das ord bringt nix, das panel bewegt sich wieder nicht selbstständig
Lhid
ontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 831



BeitragVerfasst: Do 15.01.04 20:13 
Meinung und mich grundlegend verändert.--> Beiträge gelöscht


Zuletzt bearbeitet von Lhid am Sa 26.09.09 10:20, insgesamt 2-mal bearbeitet
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: Do 15.01.04 20:16 
Zitat:
was is keypreview


Taste F1 drücken oder deine Form markieren und im Objektinspector
nach KeyPreview suchen!
CrOc Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 48

Win XP
D5 Standard
BeitragVerfasst: Do 15.01.04 20:19 
um auf lhid zurückzukommen,
es funktioniert zwar jetzt, aber wie programmier ich es, dass wenn ich die linke Pfeiltaste drücke, sich das Panel aufhört nach rechts zu bewegen und anfängt sich nach links zu bewegen.
Das ging meiner Vorstellung nach nur, wenn man vier Timer einbaut, oder?
CrOc Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 48

Win XP
D5 Standard
BeitragVerfasst: Do 15.01.04 20:20 
ich hab jetzt keypreview auf true gesetzt, bringt leider aber auch nix
Lhid
ontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 831



BeitragVerfasst: Do 15.01.04 20:23 
Meinung und mich grundlegend verändert.--> Beiträge gelöscht


Zuletzt bearbeitet von Lhid am Sa 26.09.09 10:20, insgesamt 1-mal bearbeitet
CrOc Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 48

Win XP
D5 Standard
BeitragVerfasst: Do 15.01.04 20:25 
es muss doch auch einen weg geben, dass ohne timer zu lösen, oder
Raphael O.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1596


VS 2013
BeitragVerfasst: Do 15.01.04 20:42 
was meinst du denn genau mit selbstständig bewegen?
wenn man einmal auf "rechts" klickt, dann fährt das Panel langsam an den rechten Rand?? dann bräcuhtest du einen timer..
wenn sich das panel solange bewegen soll, wie die taste gedrückt ist, dann nicht unbedingt...
Lhid
ontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 831



BeitragVerfasst: Do 15.01.04 21:01 
Meinung und mich grundlegend verändert.--> Beiträge gelöscht