Page 1 of 1

Using the function keys

Posted: Thu Dec 01, 2005 5:10 am
by Bobby227
Thanks for the welcome.

Another question that may seem silly, are the function keys usable just that same as all other keys?

How do i tell QBasic to begin another SUB on the press of F1 for example?

Thanks for your help

Posted: Thu Dec 01, 2005 8:14 am
by RayBritton
to get all key codes check this tutorial http://www.petesqbsite.com/sections/tut ... ycodes.txt

but this should work

Code: Select all

key$=""

do
key$=inkey$
loop until key$<>""

if key$=CHR$(0) + CHR$(59) then CALL yoursub

Posted: Thu Dec 01, 2005 9:00 am
by Nodtveidt
CALL isn't required; it's mainly in there for compatibility reasons.

Re: Using the function keys

Posted: Thu Dec 01, 2005 11:07 am
by Atrapado
Bobby227 wrote:how do i tell QBasic to begin another SUB on the press of F1 for example?
there are two ways to create a SUB or FUNCTION,
(A) using the menu bar you would touch Alt, E, S.
(B) just writing a line in the editor this way
SUB yourname (parameter)
and then just press Enter.
to go in and out the SUBs and FUNCTIONs press F2.

Posted: Thu Dec 01, 2005 3:20 pm
by DaveUnit
I don't think that's what he was asking Atrapado...

But anyway, just use that tutorial in the first reply, dude.

~Dave~

Posted: Fri Dec 02, 2005 2:44 am
by Guest
Thanks for that.

Very helpful.