What happens is you release the ALT key after the window looses focus so the program never recieves the keyup event. You could always send the event to windows manually
Only works on Windows, don't know how to do it on Mac or Linux:
SuperStrict
Import maxgui.drivers
Extern "win32"
Function keybd_event(bVk:Byte, bScan:Byte, dwFlags:Int, Extra:Int Ptr = Null)
End Extern
Global Window:TGadget = CreateWindow("Test",10,10,800,600)
Global Panel:TGadget = CreatePanel(0,0,ClientWidth(Window),ClientHeight(Window),Window,PANEL_ACTIVE)
Repeat
WaitEvent()
Select EventID()
Case EVENT_WINDOWCLOSE, EVENT_APPTERMINATE
End
Case EVENT_KEYDOWN
If EventMods() = 4 Then Print "Alt key pressed"
Print "Key pressed = "+EventData()
Case EVENT_WINDOWACTIVATE
DebugLog "I am here"
keybd_event($12,KEY_LALT,$02)
End Select
Forever
|