Detect Tab key + either shift key
BlitzMax Forums/BlitzMax Beginners Area/Detect Tab key + either shift key
| ||
Why dosn't this work? Select EventData() Case KEY_TAB If KeyDown(KEY_LSHIFT) Or KeyDown(KEY_RSHIFT) mapX=MapX-GadgetWidth(screen) MapX=Max(MapX,0) Else mapX=MapX+GadgetWidth(screen) MapX=Min(MapX,MapXmax) EndIf update_screen() |
| ||
Hiya, Some gadgets don't have default keyboard or mouse events emitted. To set them for specific gadgets look into SetGadgetSensitivity(gadget:TGadget,flags) You can use Print CurrentEvent.ToString() to see the event datas to aid debugging. An example:- Import MaxGui.Drivers Global Window:TGadget = CreateWindow("Test",0,0,300,200,Null,WINDOW_DEFAULT|WINDOW_CENTERED) SetGadgetSensitivity(Window,SENSITIZE_ALL) Repeat WaitEvent() Select EventID() Case EVENT_WINDOWCLOSE End Case EVENT_KEYDOWN If EventData() = KEY_TAB And EventMods() = 1 '1 for any SHIFT, 2 for any CTRL Print CurrentEvent.ToString() EndIf EndSelect Forever |
| ||
Thanks, it looks like all I needed to use was the EventsMod() function. This works; Function Main_KeyUp() Select EventData() Case KEY_TAB If EventMods()=MODIFIER_SHIFT mapX=MapX-GadgetWidth(screen) MapX=Max(MapX,0) Else mapX=MapX+GadgetWidth(screen) MapX=Min(MapX,MapXmax) EndIf update_screen() .......... |