added code to catch jumping away from dialog using TAB-key from keyboard