how to check ctrl+another key

BlitzMax Forums/MaxGUI Module/how to check ctrl+another key

hub(Posted 2007) [#1]
Hi !
How to adapt this code to check a key combination (for example ctrl+Key_delete ???
Thanks !

Case EVENT_KEYDOWN
Select EventData()
Case KEY_LSHIFT
 ' ...
case KEY_SPACE 
 ' ...
end select



grable(Posted 2007) [#2]
Try EventMods() and MODIFIER_SHIFT,MODIFIER_CONTROL,MODIFIER_OPTION,MODIFIER_SYSTEM


hub(Posted 2007) [#3]
Thanks grable, could you post an example with ctrl+space ?


grable(Posted 2007) [#4]
SuperStrict

Graphics 640,480,0

AddHook EmitEventHook, KeyHook

Repeat
	Flip
	Cls
Until KeyHit(KEY_ESCAPE) Or AppTerminate()
End

Function KeyHook:Object( id:Int, data:Object, context:Object)
	Local ev:TEvent = TEvent(data)
	If Not ev Return data	
	Select ev.id
		Case EVENT_KEYDOWN
			If (ev.Mods & MODIFIER_CONTROL) <> 0 And (ev.Data = KEY_SPACE) Then
				Print "CTRL+SPACE"
			EndIf
	EndSelect
EndFunction



JoshK(Posted 2008) [#5]
This works with mousemove events as well.