BBC BASIC for Windows
« Detecting simultaneous key presses »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:49pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Detecting simultaneous key presses  (Read 586 times)
Danny72
New Member
Image


member is offline

Avatar




PM


Posts: 20
xx Detecting simultaneous key presses
« Thread started on: Jun 14th, 2010, 6:45pm »

Hello everyone

Could someone let me know how to detect, for example if the letter j and letter f is pressed at the same time?

thanks,

Danny
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Detecting simultaneous key presses
« Reply #1 on: Jun 14th, 2010, 9:47pm »

on Jun 14th, 2010, 6:45pm, Danny72 wrote:
Could someone let me know how to detect, for example if the letter j and letter f is pressed at the same time?

Like this:

Code:
       IF INKEY(-70) AND INKEY(-68) THEN 

(the various INKEY codes are in the manual, or right-click on INKEY in the editor and select What's This?).

Beware that the test will work even if your window doesn't have 'focus' which can occasionally be inconvenient. If so there is code in the manual for checking for input focus:

http://www.bbcbasic.co.uk/bbcwin/manual/bbcwine.html#getforegroundwindow

Also be aware that you cannot reliably test for more than two keys pressed at the same time (it may sometimes work for three, or even four, keys but it depends on the keys and it depends on the keyboard!).

Richard.
User IP Logged

JonR
New Member
Image


member is offline

Avatar




PM


Posts: 24
xx Re: Detecting simultaneous key presses
« Reply #2 on: Jun 15th, 2010, 5:25pm »

To help with loooking up the INKEY codes you can use the INKEY application on my web site that shows the code for whatever key is currently pressed.

http://jonripley.com/bb4w/software/
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls