Einzelnen Beitrag anzeigen

TucTuc

Registriert seit: 20. Dez 2008
18 Beiträge
 
#21

AW: Tastenbestätigung in Delphi

  Alt 24. Jun 2010, 20:23
nun der fuktionierende code:

Delphi-Quellcode:
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
      turnscore := 0;
      ring := 0;
//Inner-Bull Ring1:
      if key = 112 then
      begin
        turnscore := 50 ; ring := 1;
      end;
//Outer-Bull Ring2:
      if key = 113 then
      begin
         turnscore := 25 ; ring := 2;
      end;
//innen-einfach Ring3:
      if key = 114 then
      begin
      turnscore := 1 ; ring := 3;
      end;
      if key = 115 then
      begin
      turnscore := 2 ; ring := 3;
      end;
      if key = 116 then
      begin
      turnscore := 3 ; ring := 3;
      end;
      if key = 117 then
      begin
      turnscore := 4 ; ring := 3;
      end;
      if key = 118 then
      begin
      turnscore := 5 ; ring := 3;
      end;
      if key = 119 then
      begin
      turnscore := 6 ; ring := 3;
      end;
      if key = 120 then
      begin
      turnscore := 7 ; ring := 3;
      end;
      if key = 121 then
      begin
      turnscore := 8 ; ring := 3;
      end;
      if key = vk_F11 then
      begin
      turnscore := 9 ; ring := 3;
      end;
      if key = vk_F12 then
      begin
      turnscore := 10 ; ring := 3;
      end;
      if key = 220 then
      begin
      turnscore := 11 ; ring := 3;
      end;
      if key = 49 then
      begin
      turnscore := 12 ; ring := 3;
      end;
      if key = 50 then
      begin
      turnscore := 13 ; ring := 3;
      end;
      if key = 51 then
      begin
      turnscore := 14 ; ring := 3;
      end;
      if key = 52 then
      begin
      turnscore := 15 ; ring := 3;
      end;
      if key = 53 then
      begin
      turnscore := 16 ; ring := 3;
      end;
      if key = 54 then
      begin
      turnscore := 17 ; ring := 3;
      end;
      if key = 55 then
      begin
      turnscore := 18 ; ring := 3;
      end;
      if key = 56 then
      begin
      turnscore := 19 ; ring := 3;
      end;
      if key = 57 then
      begin
      turnscore := 20 ; ring := 3;
      end;
//dreifach Ring4:
      if key = 48 then
      begin
      turnscore := 1 ; ring := 4;
      end;
      if key = 219 then
      begin
      turnscore := 2 ; ring := 4;
      end;
      if key = 221 then
      begin
      turnscore := 3 ; ring := 4;
      end;
      if key = 8 then
      begin
      turnscore := 4 ; ring := 4;
      end;
      if key = 45 then
      begin
      turnscore := 5 ; ring := 4;
      end;
      if key = 36 then
      begin
      turnscore := 6 ; ring := 4;
      end;
      if key = 33 then
      begin
      turnscore := 7 ; ring := 4;
      end;
      if key = 111 then
      begin
      turnscore := 8 ; ring := 4;
      end;
      if key = 106 then
      begin
      turnscore := 9 ; ring := 4;
      end;
      if key = 109 then
      begin
      turnscore := 10 ; ring := 4;
      end;
      if key = 81 then
      begin
      turnscore := 11 ; ring := 4;
      end;
      if key = 87 then
      begin
      turnscore := 12 ; ring := 4;
      end;
      if key = 69 then
      begin
      turnscore := 13 ; ring := 4;
      end;
      if key = 82 then
      begin
      turnscore := 14 ; ring := 4;
      end;
      if key = 84 then
      begin
      turnscore := 15 ; ring := 4;
      end;
      if key = 90 then
      begin
      turnscore := 16 ; ring := 4;
      end;
      if key = 85 then
      begin
      turnscore := 17 ; ring := 4;
      end;
      if key = 73 then
      begin
      turnscore := 18 ; ring := 4;
      end;
      if key = 79 then
      begin
      turnscore := 19 ; ring := 4;
      end;
      if key = 80 then
      begin
      turnscore := 20 ; ring := 4;
      end;
//außen-einfach Ring5:
      if key = 186 then
      begin
      turnscore := 1 ; ring := 5;
      end;
      if key = 187 then
      begin
      turnscore := 2 ; ring := 5;
      end;
      if key = 46 then
      begin
      turnscore := 3 ; ring := 5;
      end;
      if key = 35 then
      begin
      turnscore := 4 ; ring := 5;
      end;
      if key = 34 then
      begin
      turnscore := 5 ; ring := 5;
      end;
      if key = 36 then
      begin
      turnscore := 6 ; ring := 5;
      end;
      if key = 38 then
      begin
      turnscore := 7 ; ring := 5;
      end;
      if key = 33 then
      begin
      turnscore := 8 ; ring := 5;
      end;
      if key = 107 then
      begin
      turnscore := 9 ; ring := 5;
      end;
      if key = 65 then
      begin
      turnscore := 10 ; ring := 5;
      end;
      if key = 83 then
      begin
      turnscore := 11 ; ring := 5;
      end;
      if key = 68 then
      begin
      turnscore := 12 ; ring := 5;
      end;
      if key = 70 then
      begin
      turnscore := 13 ; ring := 5;
      end;
      if key = 71 then
      begin
      turnscore := 14 ; ring := 5;
      end;
      if key = 72 then
      begin
      turnscore := 15 ; ring := 5;
      end;
      if key = 74 then
      begin
      turnscore := 16 ; ring := 5;
      end;
      if key = 75 then
      begin
      turnscore := 17 ; ring := 5;
      end;
      if key = 76 then
      begin
      turnscore := 18 ; ring := 5;
      end;
      if key = 192 then
      begin
      turnscore := 19 ; ring := 5;
      end;
      if key = 222 then
      begin
      turnscore := 20 ; ring := 5;
      end;
//doppel Ring6:
      if key = 191 then
      begin
      turnscore := 1 ; ring := 6;
      end;
      if key = 37 then
      begin
      turnscore := 2 ; ring := 6;
      end;
      if key = 12 then
      begin
      turnscore := 3 ; ring := 6;
      end;
      if key = 39 then
      begin
      turnscore := 4 ; ring := 6;
      end;
      if key = 226 then
      begin
      turnscore := 5 ; ring := 6;
      end;
      if key = 89 then
      begin
      turnscore := 6 ; ring := 6;
      end;
      if key = 88 then
      begin
      turnscore := 7 ; ring := 6;
      end;
      if key = 67 then
      begin
      turnscore := 8 ; ring := 6;
      end;
      if key = 86 then
      begin
      turnscore := 9 ; ring := 6;
      end;
      if key = 66 then
      begin
      turnscore := 10 ; ring := 6;
      end;
      if key = 78 then
      begin
      turnscore := 11 ; ring := 6;
      end;
      if key = 77 then
      begin
      turnscore := 12 ; ring := 6;
      end;
      if key = 188 then
      begin
      turnscore := 13 ; ring := 6;
      end;
      if key = 190 then
      begin
      turnscore := 14 ; ring := 6;
      end;
      if key = 189 then
      begin
      turnscore := 15 ; ring := 6;
      end;
      if key = 35 then
      begin
      turnscore := 16 ; ring := 6;
      end;
      if key = 40 then
      begin
      turnscore := 17 ; ring := 6;
      end;
      if key = 34 then
      begin
      turnscore := 18 ; ring := 6;
      end;
      if key = 96 then
      begin
      turnscore := 19 ; ring := 6;
      end;
      if key = 110 then
      begin
      turnscore := 20 ; ring := 6;
      end;

    begin
          if turnscore > 0 then label1.Caption := FloatTostr(turnscore);
          if ring > 0 then label2.Caption := FloatTostr(ring);
          
    end;
end;
nun ein neues Problem:

ich habe festgestellt das numlock aktiviert sein muss um die numlock tasten benutzen zu können
ja ich weiss wer hätte es gedacht aber gibt es einen weg die numlocktasten dauerhaft zu aktivieren?
  Mit Zitat antworten Zitat