That's what I ended up doing in the end, I created a list containing the buttons and if it wasn't in there the program would enter "typing mode" if you then press enter/escape it will exit that mode and go back into "gamepad" mode, using the engine's gamepad functions.