Is it possible to set up an event hook which looks at some piece of data from the event object to determine that it relates to the keyboard being pressed (in general) and not a specific key?
This code is adapted from BRL.PolledInput, i take no credit:
Graphics 640,480,0 EnableAnyKey( "you", anykey) Function anykey() Notify "any-key pressed" EndFunction Repeat DrawText "Pointer", MouseX(),MouseY() Flip Cls Until KeyHit(KEY_ESCAPE) Or AppTerminate() End Private Global Enabled:Int Global InputSource:Object Global AnyCallback() Public Function EnableAnyKey( source:Object, callback()) If Enabled Then Return AnySource = source AnyCallback = callback FlushKeys() AddHook EmitEventHook,AnyKeyHook, Null, 0 Enabled = True EndFunction Function DisableAnyKey() If Not Enabled Then Return RemoveHook EmitEventHook, AnyKeyHook FlushKeys() InputSource = Null Enabled = False AnyCallback = Null EndFunction Function AnyKeyHook:Object( id:Int, data:Object, context:Object) Local ev:TEvent=TEvent(data) If Not ev Return data If InputSource And InputSource <> ev.source Then Return data Select ev.id Case EVENT_KEYUP, EVENT_KEYCHAR If AnyCallback Then AnyCallback() EndSelect Return data EndFunction