FB II Compiler

PG PRO

Debugging

Memory

System

Mathematics

Resources

Disk I/O

Windows

Controls

Menus

Mouse

Keyboard

Text

Fonts

Drawing

Sound

Clipboard

Printing

Communication

ASM

Made with FB

KEYBOARD

Break a loop with GetKeys


' -- getkeys.bas -- from code provided by rich love... thanks rich!
COMPILE 0,_caseinsensitive
DIM ggetkeys%(32)
DIM ggetkey_command%
DIM ggetkey_period%
DIM ggetkey_escape%
DIM ggetkey_shift%
DIM ggetkey_control%
DIM ggetkey_option%
END GLOBALS

LOCAL FN modifiers 
  CALL GETKEYS (ggetkeys%(0))
  ggetkey_command%=FN BITTST(VARPTR(ggetkeys%(3)),0&)'command
  ggetkey_period%=FN BITTST(VARPTR(ggetkeys%(2)),8&)'period
  ggetkey_escape%=FN BITTST(VARPTR(ggetkeys%(3)),2&)'escape
  ggetkey_shift%=FN BITTST(VARPTR(ggetkeys%(3)),15&)'shift
  ggetkey_control%=FN BITTST(VARPTR(ggetkeys%(3)),12&)'control
  ggetkey_option%=FN BITTST(VARPTR(ggetkeys%(3)),13&)'option
END FN

WINDOW 1
PRINT "press modifier keys to test function, click mouse to quit..."
DO
  FN modifiers
  IF ggetkey_command% AND ggetkey_period% THEN PRINT "command-period",
  IF ggetkey_command% AND ggetkey_period% THEN PRINT "click mouse to quit"
  IF ggetkey_command% THEN PRINT "command"
  IF ggetkey_period% THEN PRINT "period"
  IF ggetkey_escape% THEN PRINT "escape"
  IF ggetkey_shift% THEN PRINT "shift"
  IF ggetkey_control% THEN PRINT "control"
  IF ggetkey_option% THEN PRINT "option"
UNTIL FN BUTTON

?