Autor Beitrag
20:30
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 27



BeitragVerfasst: So 29.07.12 18:17 
Hallo, ich ewollte nachfragen, ob man aus einer Textdatei einen Virtual Key. herauslesen kann.

Bsp.:

Inhalt der Textdatei:
"VK_LButton"

Programm:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
var MeinKey

procedure MeinKeylesen();
begin
AssignFile(.....
while not eof(...
if....
delete(....
Blabla...
ReadLine(Datei, MeinKey);


Und dann später bei onkeydown

ausblenden Delphi-Quelltext
1:
2:
case Key of
     MeinKey: ...


Moderiert von user profile iconNarses: Beiträge zusammengefasst

FAIL! Bin wie's aussieht noch nicht ganz wach... Kann ja auch einfach das Dezimale System benutzen.

So folgt:

Inhalt der Datei: 01

Programm: StrToInt('Zeile');

Okay.. Jetzt habe ich das Problem, dass ich bei OnkeyDown diese Fehlermeldung bekomme:
Zitat:
[DCC Fehler] Screen.pas(42): E2026 Konstantenausdruck erwartet



ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure TF_Screen.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  case Key of
    MeinKey: ShowMessage('Test');
  end;
end;

Moderiert von user profile iconMartok: Delphi-Tags hinzugefügt
jfheins
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 918
Erhaltene Danke: 158

Win 10
VS 2013, VS2015
BeitragVerfasst: So 29.07.12 19:39 
Benutze if-Abfragen statt case...of ;)

Für diesen Beitrag haben gedankt: 20:30