new topic     » goto parent     » topic index » view thread      » older message » newer message

------=_NextPart_000_0306_01BFD736.FCA5E6C0
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

On keyboard input:

See get_key, wait_key, getc, and run key.bat. If you search for codes, =
don't forget that key codes are one thing (they are the codes that =
represent each keyboard key) and scan codes are another (the codes the =
OS actually gets, including combinations with Ctrl, Shift and Alt (Meta, =
if you do Linux). Also: the codes for the main keyboard numbers are not =
the same as the codes for the numeric (or tenkey) pad.

---- This will tell you what key you pressed.

include d:\euphoria\include\get.e -- wait_key
atom kcmd

while 1 do
  puts(1,"Press a key. End with Ctl-C.\n")
  kcmd =3D wait_key()
  printf(1,"You pressed a %d\n",kcmd)
end while

--- And this will act upon keypresses.

  sequence up_lst
  up_lst =3D {328, 56, 45, 60}      -- up arrows, minus, <
  ...........
  kcmd =3D wait_key()
  if find(kcmd, up_lst) then
        -- user wants to go up, do something
  end if
  if (kcmd =3D 337 or kcmd =3D 51) then
--- PgDn, do something
  end if
  if (kcmd =3D 304) then
--- Alt-B, do something
  end if

Good luck.

Gerardo E. Brandariz
  ----- Original Message -----=20
  From: =08=08=20
  To: EUPHORIA at LISTSERV.MUOHIO.EDU=20
  Sent: Tuesday, June 13, 2000 6:22 AM


  This may sound like a stupid question but ...... HOW DA HELL DO YOU =
PROGRAM THE KEABORD !!!! I just don`t understand . How do I program the =
keabord so that when I press a key the computer know that it is the F =
(or any other
  key ) and then somthing hapens like a bom expodes . In Basic all you =
have to do
  is type INKEY =3D F ( or any other key ) . Please reply . Thanks .

  Ferdinand Greyling
  from
  Terminal Software

------=_NextPart_000_0306_01BFD736.FCA5E6C0
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2014.210" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT size=3D2>On keyboard input:</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>See get_key, wait_key, getc, and run key.bat. If you =
search=20
for codes, don't forget that key codes are one thing (they are the codes =
that=20
represent each keyboard key) and scan codes are another (the codes the =
OS=20
actually gets, including combinations with Ctrl, Shift and Alt (Meta, if =
you do=20
Linux). Also: the codes for the main keyboard numbers are not the same =
as the=20
codes for the numeric (or tenkey) pad.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>---- This will tell you what key you =
pressed.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>include d:\euphoria\include\get.e&nbsp;-- =
wait_key<BR>atom=20
kcmd</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>while 1 do<BR>&nbsp; puts(1,"Press a key. End with=20
Ctl-C.\n")<BR>&nbsp; kcmd =3D wait_key()<BR>&nbsp; printf(1,"You pressed =
a=20
%d\n",kcmd)<BR>end while</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>--- And this will act upon keypresses.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>&nbsp; sequence up_lst</FONT></DIV>
<DIV><FONT size=3D2>&nbsp; up_lst =3D {328, 56, 45,=20
60}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- up arrows, minus, &lt;</FONT></DIV>
<DIV><FONT size=3D2>&nbsp; ...........</FONT><FONT =
size=3D2></FONT></DIV>
<DIV><FONT size=3D2>&nbsp; kcmd =3D wait_key()</FONT></DIV>
<DIV><FONT size=3D2>&nbsp; if find(kcmd, up_lst) then</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; -- user wants =
to go up,=20
do something</FONT></DIV>
<DIV><FONT size=3D2>&nbsp; end if<BR>&nbsp; if (kcmd =3D 337 or kcmd =3D =
51)=20
then<BR>--- PgDn, do something</FONT></DIV>
<DIV><FONT size=3D2>&nbsp; end if<BR>&nbsp; if (kcmd =3D 304) =
then<BR>--- Alt-B, do=20
something
<DIV><FONT size=3D2>&nbsp; end if<BR></FONT><BR>Good =
luck.</DIV></DIV></FONT>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>Gerardo E. Brandariz</FONT></DIV>
<BLOCKQUOTE=20
style=3D"BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: =
0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">
  <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV=20
  style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>From:</B>=20
  <A href=3D"mailto:mwfch at MWEB.CO.ZA" =
title=3Dmwfch at MWEB.CO.ZA>=08=08</A> </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A=20
  href=3D"mailto:EUPHORIA at LISTSERV.MUOHIO.EDU"=20
  title=3DEUPHORIA at LISTSERV.MUOHIO.EDU>EUPHORIA at LISTSERV.MUOHIO.EDU</A> =
</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Tuesday, June 13, 2000 =
6:22=20
AM</DIV>
  <DIV><BR></DIV>
  <DIV><FONT face=3DArial size=3D2>This may sound like a stupid question =
but ......=20
  HOW DA HELL DO YOU PROGRAM THE KEABORD !!!! I just don`t understand . =
How=20
  do&nbsp;I program the keabord so that when I press a key the computer =
know=20
  that it is the F (or any other</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>key ) and then somthing hapens like a =
bom expodes=20
  . In Basic all you have to do</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>is type INKEY =3D F ( or any other =
key ) . Please=20
  reply . Thanks .</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>Ferdinand Greyling</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>from</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>Terminal=20

------=_NextPart_000_0306_01BFD736.FCA5E6C0--


__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu