ok i dont really know how to explain this but...

c:=readkey;

case (c) of
#13:Halt;
#27:goto menu else goto quit;

as you can see above if you press Esc(which is 13) the program quits and if you press Enter(which is 27) it gos to the menu. I want to know if theres a list somewhere which tells me the number for each keyboard number. does anyone know where i can find 1?

Recommended Answers

All 5 Replies

ok i dont really know how to explain this but...

c:=readkey;

case (c) of
#13:Halt;
#27:goto menu else goto quit;

as you can see above if you press Esc(which is 13) the program quits and if you press Enter(which is 27) it gos to the menu. I want to know if theres a list somewhere which tells me the number for each keyboard number. does anyone know where i can find 1?

Hi.
If you google ASCII Table there are loads of sites that will give you the complete ASCII codes that your keyboard uses. I used to use them when I started coding if I needed to display a % or half symbol etc.
Good luck

thanks for the reply. i have tried checking online but the tables confuse me. i made a program instead to show the ascii code of the buttons i press.

ok i dont really know how to explain this but...

c:=readkey;

case (c) of
#13:Halt;
#27:goto menu else goto quit;

as you can see above if you press Esc(which is 13) the program quits and if you press Enter(which is 27) it gos to the menu. I want to know if theres a list somewhere which tells me the number for each keyboard number. does anyone know where i can find 1?

OK, here is the thing .....

Ascii values are CHAR, and are used with keypress events.

However, there are also delphi (windows) constants for the keys also, with the win32 foundation. They are virtual keys, with values defined as constants. They are word values, and have a numeric (integer) value.

Keydown and keyup events pass a Virtual KEY value, keypress passes an ascii value.

VK_ENTER
VK_ESCAPE
VK_LEFT
VK_PGUP
VK_F1 through VK_F24
VK_CTRL

you get the idea.

as it happens, you can use key values in sets.

consider a function passed a key value k ....

you can test as follows;


if k in [vk_escape,vk_enter,vk_f1] then ....

hope that gets you going in the right direction.

Prism will handle keyboard scancodes according to .Net I am sure, and the codes will be different I am also sure.

Good luck

Hi killhha.
I know that your thread is solved.
I wrote a little program for the ascii table's key codes:

Program solution;
Uses Crt;
Var i:Byte;
Begin
     WriteLn('The numbers are:');
     For i:=0 To 255 Do WriteLn('#',i:3,'=',Chr(i));
     WriteLn('Press enter to continue...');
     ReadLn;
End.

But if you want to see the whole table into picture then I zipped them to you :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.