[futurebasic] a useful function...

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 1997 : Group Archive : Group : All Groups

From: Bowerbird@...
Date: Fri, 28 Nov 1997 15:03:13 -0500 (EST)
' -- 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