forums

TNT Basic Forums > Programming Q&A
Unresponsive keyboard
< Last Thread     Next Thread >
Author
Thread        Post A Reply

01-20-2003 08:48

Posted by:
mark_667

Location:
England

Click Here to Email mark_667   Find more posts by mark_667

Hi,
This is probably just something simple again, but when I run this code, the user should have the option to press a corresponding key (return) for an option.

if pressed (36)
print"blah, blah"
Print "blah, blah"
print"Click mouse to end..."
end if

This runs fine, but when the return key is pressed nothing happens, there are no run time errors, etc and even when I change the first line to presed (0-129) to include all keyboard keys, again, nothing happens. I use an old-style beige Mac keyboard, I don't know if this makes any difference to the poll input values or if this is just a case of bad syntaxing or even a bug. This is much shorter & simpler than using buttons and other alternatives, so if anyone can find a way of doing it with this meathod, it'll be much apreciated.

thanks,
mark_667

01-20-2003 20:59

Posted by:
Mark Tully

Location:
TNT HQ, England

Click Here to Email Mark Tully   Find more posts by Mark Tully

Does it work under OS 9?

If it works under 9 but not X it will be the input but in Mac OS X, if it doesn't work in either then it's likely to be a bug in your code :(

Cheers,

Mark

01-20-2003 22:45

Posted by:
eekaydee

Location:
CA, USA

Click Here to Email eekaydee   Find more posts by eekaydee

Just checking

Did you put your piece of code in a loop? :P If not, then your program will check the key that one moment and keep going.

repeat
if pressed (36)
print"blah, blah"
Print "blah, blah"
print"Click mouse to end..."
end if
until mouse button 'or until pressed (36)

When I ran this code, pressing return brought up the output window and printed that until I let go.

01-21-2003 02:57

Posted by:
Holmes

Location:
Santa Rosa, Ca

Click Here to Email Holmes   Find more posts by Holmes

I have the same problem (I think).

Log out and back in, thats what works for me.

01-22-2003 01:01

Posted by:
Machi

Click Here to Email Machi   Find more posts by Machi

Hi - the code given above worked for me under OSX using v1.12

Umm......you are using a proper "while" aren't you ?

01-22-2003 10:53

Posted by:
mark_667

Location:
England

Click Here to Email mark_667   Find more posts by mark_667

Loops

In response to all your questions, I am using OS 9, don't know if this bug still happens under OSX, although I have not included it in a loop - I didn't think there was a need, thanks for the suggestions.
Mark_667

01-22-2003 20:52

Posted by:
Mark Tully

Location:
TNT HQ, England

Click Here to Email Mark Tully   Find more posts by Mark Tully

Post code

If it doesn't work in 9 then I'm afraid it's going to be a bug in your code. If you post the larger chunk of it we can have a look at it with you?

Mark

01-24-2003 10:53

Posted by:
mark_667

Location:
England

Click Here to Email mark_667   Find more posts by mark_667

Fixed!

Thanks for all the help, it turned out I just needed to loop it, it now looks something like:

if pressed(36)
print "Blah, blah"
print "Click to end"
until pressed(36)
. . . . 'Do some more stuff here
end if

Put it down to inexperience!

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.