BBC BASIC for Windows
Programming >> BBC BASIC language >> Escape Key
http://bb4w.conforums.com/index.cgi?board=language&action=display&num=1321512645

Escape Key
Post by bruceoboast on Nov 17th, 2011, 05:50am

How does one use the escape key?
Re: Escape Key
Post by admin on Nov 17th, 2011, 11:24am

on Nov 17th, 2011, 05:50am, bruceoboast wrote:
How does one use the escape key?

Anyway you like!

By default, pressing Esc generates an error (error code 17) which will abort your program, or can be trapped using ON ERROR or ON ERROR LOCAL in the usual way (but note the caveat when using PRIVATE).

Alternatively you can issue the *ESC OFF command, in which case Esc behaves like a regular key, and can be read using INKEY or GET (key code 27).

Lastly, you can detect (asynchronously) when the Esc key is depressed using INKEY(-113).

Richard.
Re: Escape Key
Post by bruceoboast on Nov 18th, 2011, 05:35am

Thanks, the "*ESC OFF " was what I needed. The othe info may come in handy later.

Bruce
Re: Escape Key
Post by Alba Smith on Mar 3rd, 2012, 04:26am

How do you write 'ESC OFF'? What is the entire command you need to write?




Kitchen Faucets
Re: Escape Key
Post by admin on Mar 3rd, 2012, 09:11am

on Mar 3rd, 2012, 04:26am, Guest-Alba Smith wrote:
How do you write 'ESC OFF'? What is the entire command you need to write?

It's a 'star command', simply prefix it with an asterisk:

Code:
  *ESC OFF 

If you prefer you can use OSCLI, but there's little benefit in this case:

Code:
  OSCLI "ESC OFF" 

Richard.