Qbasicnews.com

Full Version: Arrow Keys in FB?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Say, why doesn't the following commands seem to work in FB??

Code:
press$ = INKEY$
IF press$ = CHR$(0) + "H" THEN
IF press$ = CHR$(0) + "P" THEN
..ect..

I've even tried using the ASCII for H, P, M, & K,.. but I always get a error or doesn't work.. Any help?? :???:
use chr$(255), not chr$(0). i think this is because chr$(0) is used as a end character for strings in linux.
It's because the NULL term char is used with C (not Linux), and the FB runtime library mostly just calls C runtime routines for string manipulation.
Right,. I'll try that. :wink: , Thanks...
Yep, that's all it needed, thanks. Big Grin :wink:
if you use multikey in you code the following code is your arrow keys as copied from gfxlib

Code:
IF MULTIKEY(&h4B) AND x > 0 THEN x = x - 1
    IF MULTIKEY(&h4D) AND x < 639 THEN x = x + 1
    IF MULTIKEY(&h48) AND y > 0 THEN y = y - 1
    IF MULTIKEY(&h50) AND y < 479 THEN y = y + 1

you can obviously change the end result to what you need but this is what your looking for
Hay, thats cool,.. does it do as it seems, more than 1 keypress at a time is regestered? so no jamming? Smile
nope no jamming the codes look specifically for the arrow keys only but on multiple keypress the routine so to speak is quicker than the key press so it can register and translate each code before becoming "jammed"
Big Grin , Thats sweet!!, I'll have to remamber that next time!! :wink: