why not use the keypress to set a (global/static) "mode" variable that determines which mode to invoke?