Autor Beitrag
freak89
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 29



BeitragVerfasst: So 27.03.05 00:55 
bei diesem code der eg schöne striche zeichnen sollte macht delphi 2 nix zeigt aber auch keine fehlermeldung an. unter delphi 7 läuft es. wie kann ich das problem beheben, danke im vorraus.
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:
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
var x,y:integer;
begin
  with image1.canvas do begin
    x:= penpos.x;
    y:= penpos.y;
    case key of
       vk_down: inc(y);
       vk_up:   dec(y);
       vk_left: dec(x);
       vk_right:inc(x);
       VK_NUMPAD1: begin dec(x); inc(y); end;
       VK_NUMPAD2: begin  inc(y); end;
       VK_NUMPAD3: begin inc(x); inc(y); end;
       VK_NUMPAD4: begin dec(x); end;
       VK_NUMPAD6: begin inc(x); end;
       VK_NUMPAD7: begin dec(x); dec(y); end;
       VK_NUMPAD8: begin  dec(y); end;
       VK_NUMPAD9: begin inc(x); dec(y); end;
        VK_NUMPAD5: begin
        if write = 0 then
         write := 1
         else write := 0 end;
    end;
 if write = 1
 then lineto(x,y)
 else if write = 0
 then begin moveto(x,y);
      end;
  end;
end;

end.


Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt.
Blackheart
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 164

ME
D3Prof.-D6Standard
BeitragVerfasst: So 27.03.05 01:08 
Warum soll es auf Delphi 2 laufen, wenn es auf Delphi 7 läuft ?
Verstehe die Frage Nicht?
Den Anwender deines Programms wird's wohl kaum drauf ankommen in welcher Version von Delphi oder C++ oder... du dieses programmiert hast.
Hauptsache man kann das Programm für seine Zwecke einsetzen. (Delphi 2 ist auch schon etwas veraltet, vieleicht deswegen)!
freak89 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 29



BeitragVerfasst: So 27.03.05 01:17 
es MUSS auf delphi2 laufen, das ganze ist ein schulprojekt, in der schule haben wir nur delphi 2 und auch nur delphi 2 ist mit der alten fischertechnik kompatibel. Also wie kann ich den Fehler verschwinden lassen?
Raphael O.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1596


VS 2013
BeitragVerfasst: So 27.03.05 01:18 
hast du das ganze mal debuggt?
damit sollte die Fehlerquelle recht schnell gefunden sein ;)
freak89 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 29



BeitragVerfasst: So 27.03.05 01:55 
so ich weiß woran es liegt, aber ich bin nicht schlauer als voher, als das on key down ergeignis wird einfach nciht ausgelöst, das muss ein fehler von delphi 2 und kein anwenderfehler sein, wisst ihr wie man das umgehen kann?
Raphael O.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1596


VS 2013
BeitragVerfasst: So 27.03.05 02:06 
kann es sein, dass ein anderes Control deiner Form den Fokus hat und deshalb das Form-KeyDown-Ereignis nicht ausgelöst wird?
hat D2 evtl. noch nicht die Property KeyPreview, bzw. ist die nicht aktiviert bei der Form?
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: So 27.03.05 08:34 
Mach mal bei OnShow oder in nem Timer:

ausblenden Delphi-Quelltext
1:
Form1.SetFocus;					

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
wdbee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 628
Erhaltene Danke: 1



BeitragVerfasst: So 27.03.05 08:39 
Stell mal fest, ob dieses Ereignis nie ausgelöst wird, oder ob es nur für die gewünschten Tasten nicht aufgerufen wird. Pfeiltasten werden z.T. anders behandelt als Buchstabentasten.
freak89 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 29



BeitragVerfasst: So 27.03.05 11:08 
das mit setfocus ändert auch nichts, bei den numblocktasten tut sich gar nix und wenn ich die pfeiltasten drücke springt er zwischen 2 button hin und her, die ich in meiner form habe
wdbee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 628
Erhaltene Danke: 1



BeitragVerfasst: So 27.03.05 11:31 
Probier mal folgendes:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
...
TForm1.KeyPreview := True;
...
procedure TForm1.DoMessage(var Msg: TMsg; var Handled: Boolean);
begin
  if Msg.message = WM_CHAR then
  begin
    ShowMessage('WM_CHAR');               // Keine Reaktion bei Pfeiltasten?
    Handled := True;
  end
  else if Msg.message = WM_KEYDOWN then
  begin 
    ShowMessage('WM_KEYDOWN');            // Reaktion bei Pfeiltasten?
    Handled := True;
  end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Application.OnMessage := DoMessage;
end;


Wenn das auch bei D2 so stimmt, dann musst du die Message hier behandeln.