C (69/207)

From:Laura Vance
Date:09 Dec 99 at 01:55:17
Subject:Re: Reading keypresses

From: Laura Vance <vancel@amiga.nols.com>

Hello Donald

I'm sure that I'm not the first one to answer this, but in the case
statements, you can use the ascii codes or the rawkey codes, depending on
which you are using in your window. For example, you detect the CR (Carriage
Return) by checking for code 13, if I remember correctly, the ESC character
is code 27. I don't have the chart right here in front of me, but they are
very handy when you are trying to do just such functions.

later,

Laura

On 08-Dec-99, Donald W Millican wrote:
> From: "Donald W Millican" <DonaldWM@stonelawdrive.freeserve.co.uk>
>
> Using StormC3.0, I have written a calculator using gadtools to program
> intuition and would like to be able to detect the pressing of the keys:
> Return, Enter, Backspace, Del, Escape and Space.
> I need to detect Return and Enter as they would be shortcuts for the equals
> key. I want use Backspace for a take-back function I have yet to create. For
> the other keys I just want to make sure that if they are pressed, that the
> Calculator ignores those keypresses. At the moment, pressing any of these
> keys is taken as input and the calculator adds the previously entered number
> to the display.
>
> I get the key code from the Code field of the Intuimessage I am sent by
> Intuition and parse it as follows:
>
> switch(code)
> {
> case `1`:
> // Deal with a 1 being entered
> break;
> etc.
>
> I thought I could read Space as:
> case ` `:
> printf("Space entered");
> and Return / Enter as:
> case `\n`:
> printf("Return / Enter entered");
>
> I have tried these ideas but the messages are never displayed no matter
> which way I go about displaying them.
>
> Any ideas?
>
> > -> Spread the URL: http://www.onelist.com/subscribe/amiga-c <-
>
Regards



\|/
(o o)
--ooO(_)Ooo--
Peekaboo!