Autor Beitrag
Jasonier
Hält's aus hier
Beiträge: 1



BeitragVerfasst: Sa 16.04.11 15:22 
Hallo,

Ich beschäftige mich seit kurzem mit Delphi und bin nun dabei mit der ASCII Tabelle zu arbeiten.
Dabei funkioniert folgendes bei mir nicht.
Könnt ihr mir bitte helfen
ausblenden Delphi-Quelltext
1:
if key = 80 then button1.top := button1.top+1;					


Moderiert von user profile iconNarses: Quote- durch Delphi-Tags ersetzt
Robii
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 236



BeitragVerfasst: Sa 16.04.11 15:30 
Zitat:
if key = 80 then button1.top := button1.top+1;


Hey Jasonier,

die Zeile, die du gepostet hast, ist an sich richtig, kann es vielleicht daran liege, dass key nicht gleich 80 ist? Vielleicht solltest du etwas mehr Quelltext posten, fals der Fehler woanders liegt.

Lieben Gruß,
Robii
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19326
Erhaltene Danke: 1749

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 16.04.11 15:31 
Hallo und :welcome:
user profile iconJasonier hat folgendes geschrieben Zum zitierten Posting springen:
ausblenden Delphi-Quelltext
1:
 if key = 80 then button1.top := button1.top+1;					
Ich rate einmal, dass das in OnKeyPress steht?
Dann muss das so aussehen:
ausblenden Delphi-Quelltext
1:
2:
 if key = #80 then
  button1.top := button1.top+1;
Einfacher wäre es, wenn du geschrieben hättest was nicht funktioniert. Kommt eine Fehlermeldung, passiert nichts, ...?
Tilman
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1405
Erhaltene Danke: 51

Win 7, Android
Turbo Delphi, Eclipse
BeitragVerfasst: Sa 16.04.11 17:10 
Hinzu kommt, dass das OnKeyPress Ereignis auch ausgeführt werden muss. Wenn du das Event vom Form benutzt, dann funktioniert es nicht sobald der Button markiert wurde. Ist es das Event vom Button, dann MUSS der Button markiert sein.

_________________
Bringe einen Menschen zum grübeln, dann kannst du heimlich seinen Reis essen.
(Koreanisches Sprichwort)
bummi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1248
Erhaltene Danke: 187

XP - Server 2008R2
D2 - Delphi XE
BeitragVerfasst: Sa 16.04.11 17:37 
nuja, eigentlich muss er ja nur Keypreview aktivieren..

_________________
Das Problem liegt üblicherweise zwischen den Ohren H₂♂
DRY DRY KISS