Surprising behaviour of Alt Gr key

I've put this in the 'General BBC BASIC' section because it probably affects all versions of BBC BASIC running on a Windows PC. It certainly affects Matrix Brandy, BBC BASIC for Windows, BBC BASIC for SDL 2.0 and Red Squirrel.

Apparently this has been the case ever since the Alt Gr key appeared on PC keyboards (to the right of the space bar) but I never knew it until very recently: If you press the Alt Gr key the left-hand Ctrl key will also appear to be pressed!

You can try it for yourself in a suitable Windows browser here (sorry, not Internet Explorer).

To avoid this behaviour upsetting your own programs you can usefully test for a Ctrl key being pressed as follows:
      IF INKEY(-2) AND NOT INKEY(-9) THEN ...
I must emphasise that this is NOT a bug, feature or characteristic of BBC BASIC, it is a feature of the Operating System which BBC BASIC correctly passes on.
Sign In or Register to comment.