Keyboard.res

Liste des évennements et des fonctions associées:
- #PB_Event_KeyboardInkey
EventInkey()
EventKeyRepeatCount()
EventKeyScanCode()
EventKeyIsExtended()
EventKeyPreviousState()
EventKeyTransitionState() - #PB_Event_KeyboardReleased
EventKey()
EventKeyRepeatCount()
EventKeyScanCode()
EventKeyIsExtended()
EventKeyPreviousState() - #PB_Event_KeyboardPushed
EventKey()
EventKeyRepeatCount()
EventKeyScanCode()
EventKeyIsExtended()
EventKeyPreviousState()
Et le code pour ceux que ca intéresse (rien d'extraordinaire...)
Code : Tout sélectionner
#PB_Event_KeyboardInkey = #WM_CHAR
#PB_Event_KeyboardReleased = #WM_KEYUP
#PB_Event_KeyboardPushed = #WM_KEYDOWN
Enumeration ;Key State
#PB_Key_Released
#PB_Key_Pushed
EndEnumeration
Macro EventKey()
EventwParam()
EndMacro
Macro EventInkey()
Chr( EventwParam() )
EndMacro
Macro EventKeyRepeatCount()
(EventlParam() & $FFFF)
EndMacro
Macro EventKeyScanCode()
((EventlParam() >> 16) & $FF)
EndMacro
Macro EventKeyIsExtended()
((EventlParam() >> 24) & $1)
EndMacro
Macro EventKeyPreviousState()
((EventlParam() >> 30) & $1)
EndMacro
Macro EventKeyTransitionState()
((EventlParam() >> 31) & $1)
EndMacro
Code : Tout sélectionner
If OpenWindow(0, 0, 0, 270, 160, "Keyboard Events", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CreateGadgetList(WindowID(0))
TextGadget(0, 10, 10, 250, 20, "Dernier caractère saisi : ")
TextGadget(1, 10, 40, 250, 20, "Dernière touche pressée : ")
TextGadget(2, 10, 70, 250, 20, "Dernière touche relachée : ")
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_KeyboardInkey
String$ = GetGadgetText(0)
String$ = StringField(String$, 1, #TAB$) + #TAB$ + EventInkey()
SetGadgetText(0, String$)
Case #PB_Event_KeyboardPushed
String$ = GetGadgetText(1)
String$ = StringField(String$, 1, #TAB$) + #TAB$ + Str( EventKey() )
SetGadgetText(1, String$)
Case #PB_Event_KeyboardReleased
String$ = GetGadgetText(2)
String$ = StringField(String$, 1, #TAB$) + #TAB$ + Str( EventKey() )
SetGadgetText(2, String$)
EndSelect
Until Event = #PB_Event_CloseWindow
EndIf
