Board Logo
« esc key »

Welcome Guest. Please Login or Register.
Jan 18th, 2018, 3:43pm


Conforums Terms of Service | Membership Rules | Home | Search | Recent Posts | Notification | Format Your Message | Installation FAQ

Problems installing JB? Read the Vista/Win7 Installation FAQ

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: esc key  (Read 948 times)
donwhi
New Member
Image


member is offline

Avatar




PM


Posts: 9
xx esc key
« Thread started on: Jan 4th, 2016, 6:37pm »

I used the escape key [chr$(27)] in MS Basic. It doesn't seem to work with Just BASIC. Am I correct or is there some other issue? Thanks
User IP Logged

Facundo
Board Moderator


member is offline

Avatar




PM

Gender: Male
Posts: 1303
xx Re: esc key
« Reply #1 on: Jan 4th, 2016, 7:04pm »

First welcome to the community donwhi!
About the escape key, where do you want to 'catch' that key?

Here an example using a graphics type window
Code:
    open "Press the escape key" for graphics as #main
     #main "when characterInput [fetchkey]"
     #main "trapclose [quit]"
     #main "setfocus"
    wait
    [quit]
    close #main
    end
    [fetchkey]
    keyValueF = asc(right$( Inkey$, 1 ))
     select case keyValueF
        case _VK_F1
            print "F1"
        case _VK_F2
            print "F2"
        case _VK_PAUSE
            print "Pause"
        case _VK_ESCAPE
            print "Bye bye"
            goto [quit]
     end select
    wait

 
User IP Logged

cundo aka MSlayer
donwhi
New Member
Image


member is offline

Avatar




PM


Posts: 9
xx Re: esc key
« Reply #2 on: Jan 5th, 2016, 07:06am »

thanks Facundo,
I was trying to use it to bail out from a MS basic program I had written some time ago. My program ran in the console window, without any graphics. I just started with Just BASIC and am finding my way through the syntax differences.
User IP Logged

Rod
Administrator
ImageImageImageImageImage


member is offline

Avatar

Graphics = Goosebumps!


PM

Gender: Male
Posts: 3151
xx Re: esc key
« Reply #3 on: Jan 5th, 2016, 09:02am »

If you are in a closed loop and can't escape then press the break key on your keyboard. On my keyboard it is Ctrl+Break you will need to experiment with your own keyboard. Just BASIC will stop the loop and you will be able to get back to the IDE and kill any running program.

In any computational loop that might need interrupted by a keypress or a button press you will need to put a scan statement in the deepest part of the loop. This will allow Just BASIC to see and react to interrupting events.

Most often interrupts are handles by the wait statement at the end of code blocks.
User IP Logged

donwhi
New Member
Image


member is offline

Avatar




PM


Posts: 9
xx Re: esc key
« Reply #4 on: Jan 30th, 2016, 2:25pm »

ok, thanks. feeling my way along with Just BASIC for the time being. Don
User IP Logged

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

Conforums Terms of Service | Membership Rules | Home | Search | Recent Posts | Notification | Format Your Message | Installation FAQ

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls