comp.lang.ada
 help / color / mirror / Atom feed
* Re: Reading from keyboard (was: Here's a quicky - please help!)
       [not found] <01bc5a54$49a60120$9a82a6c3@swh2tpv>
@ 1997-05-06  0:00 ` Stephen Leake
  1997-05-07  0:00 ` Here's a quicky - please help! Albert K. Lee
  1997-05-08  0:00 ` Michael F Brenner
  2 siblings, 0 replies; 3+ messages in thread
From: Stephen Leake @ 1997-05-06  0:00 UTC (permalink / raw)



Chris Westcott wrote:
> 
> Please, please,please help me.
> I am fairly new to ADA but have been programming in Pascal for some time
> now.
> Could somebody please help me in reading from the keyboard!!

It's more polite to put the real subject in the subject line. A lot of
us just ignore articles that only say "Please help!". You caught me at
the end of the day, when I don't have the energy for real work :-)

> 
> By doing:
>         GET(inkey);
> where inkey is a character, GET waits for a cariage return before accepting
> the key.
> I want to get the key without pressing <CR>.
> Can you please help.

See Text_IO.Get_Immediate. This is supposed to not wait for the <CR>,
but it depends on whether your compiler does this or not. The latest
version of GNAT does, at least for some platforms. (It is also polite to
say what platform you are using, and what version of what compiler).

> 
> Also I am trying to use the cursor keys but have no idea how to get them to
> work.  Is there some way of reading them.  (Scan codes/ or ASCII)

I can't help you there, but there are some packages that have been
written to do this. Start at the Ada home web page:

http://www.adahome.com/

and look around for resources and/or source code libraries. You'll find
it, and lots of other good stuff, to.

> 
> Thank you
>         Chris Westcott.

You're welcome

> 
> PS- I am a student and I won't go away!!!!

This is NOT an effective threat; it's easy to ignore annoying posts
(just skip any subject line that is not meaningfull !-)

-- 
- Stephe




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Here's a quicky - please help!
       [not found] <01bc5a54$49a60120$9a82a6c3@swh2tpv>
  1997-05-06  0:00 ` Reading from keyboard (was: Here's a quicky - please help!) Stephen Leake
@ 1997-05-07  0:00 ` Albert K. Lee
  1997-05-08  0:00 ` Michael F Brenner
  2 siblings, 0 replies; 3+ messages in thread
From: Albert K. Lee @ 1997-05-07  0:00 UTC (permalink / raw)



On 6 May 1997 11:10:14 GMT, Chris Westcott <chris@westcott.force9.net> wrote:
>
>By doing:
>	GET(inkey);
>where inkey is a character, GET waits for a cariage return before accepting
>the key.
>I want to get the key without pressing <CR>.

Get_Immediate should do the trick.  You should get a copy of the
reference manual and look at the annexes (especially annex A).  There
are lots of goodies in there.

>Also I am trying to use the cursor keys but have no idea how to get them to
>work.  Is there some way of reading them.  (Scan codes/ or ASCII)

I believe this will depend on the hardware and/or operating system
you're using, though I could be wrong.

>PS- I am a student and I won't go away!!!!

A little _too_ persistent...  =)


-Albert K. Lee
 also a student




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Here's a quicky - please help!
       [not found] <01bc5a54$49a60120$9a82a6c3@swh2tpv>
  1997-05-06  0:00 ` Reading from keyboard (was: Here's a quicky - please help!) Stephen Leake
  1997-05-07  0:00 ` Here's a quicky - please help! Albert K. Lee
@ 1997-05-08  0:00 ` Michael F Brenner
  2 siblings, 0 replies; 3+ messages in thread
From: Michael F Brenner @ 1997-05-08  0:00 UTC (permalink / raw)



This is a bug in the Run-Time Library your are using. When a file is
connected to the keyboard it should be connected properly using a keyboard
interrupt and should already pass you byte codes for all cursor keys.

Unfortunately, this bug is endemic to several compilers in several languages,
and the vendors tend to justify it, giving their personal opinions that
this stuff should fail the way it fails, by design.

You can program direct access to the keyboard by calling operating
system primitives, like getkey, read_kbd_no_echo, DOS interrupt 21, 
BIOS interrupt 16#16#, or intercepting the keyboard interrupt yourself. 
The easiest is to call the operating system primitive using your
compiler-specific library. 

This would not be a problem if there was a single key code list such that
on every operating system and hardware, for example, control-up-arrow
always returned code 253, etc. Even Unicode (for foreign languages)
did not address the arrow keys, shift, control, alt (command), function
keys, etc.

In my opinion Ada should standardize such a key code list in an optional
package which can then start the process of being implemented everywhere.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1997-05-08  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <01bc5a54$49a60120$9a82a6c3@swh2tpv>
1997-05-06  0:00 ` Reading from keyboard (was: Here's a quicky - please help!) Stephen Leake
1997-05-07  0:00 ` Here's a quicky - please help! Albert K. Lee
1997-05-08  0:00 ` Michael F Brenner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox