1. Question, Please Help

I see that the get_key() function allows for the program to get the next key
pressed without waiting. How do I assign that key's identity (a numeric
value I'm guessing) to a variable so that I can manipulate it?

while get_key() = -1 do
bla bla bla
end while

But how do I take whatever key was pressed and use it?

-Phil


_______________________________________________________________
Get Free Email and Do More On The Web. Visit http://www.msn.com

new topic     » topic index » view message » categorize

2. Re: Question, Please Help

>I see that the get_key() function allows for the program to get the next
>key
>pressed without waiting. How do I assign that key's identity (a numeric
>value I'm guessing) to a variable so that I can manipulate it?
>
>while get_key() = -1 do
>bla bla bla
>end while
>
>But how do I take whatever key was pressed and use it?
>
>-Phil

You can answer your own question! You wrote:

   get_key() = -1

which means get_key() is a function. All you have to do is turn it around...

   variable = get_key()


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

new topic     » goto parent     » topic index » view message » categorize

3. Re: Question, Please Help

At 05:53 27/05/99 GMT, you wrote:
>>I see that the get_key() function allows for the program to get the next
>>key
>>pressed without waiting. How do I assign that key's identity (a numeric
>>value I'm guessing) to a variable so that I can manipulate it?
>>
>>while get_key() = -1 do
>>bla bla bla
>>end while
>>
>>But how do I take whatever key was pressed and use it?
>>
>>-Phil
>
>You can answer your own question! You wrote:
>
>   get_key() = -1
>
>which means get_key() is a function. All you have to do is turn it around...
>
>   variable = get_key()
>
>

For a practical demonstration of
this, try:

ex ed c:\euphoria\bin\key.ex

at the dos prompt.
(assuming you have EU on drive C)



----------------------------------------------------

new topic     » goto parent     » topic index » view message » categorize

4. Question, Please Help

> I see that the get_key() function allows for the program to get the next
> key pressed without waiting. How do I assign that key's identity (a
> numeric value I'm guessing) to a variable so that I can manipulate it?
>
> while get_key() = -1 do
> bla bla bla
> end while
>
> But how do I take whatever key was pressed and use it?
>
> -Phil

Try the following code:
integer key
key = get_key()
while key = -1 do
    key = get_key()
end while
printf(1, "The code of the key pressed was: %d", key)

I hope I didn't make any mistakes since I haven't tested it!

Bye,

Martin Schut

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu