If you may limit your application to Unix/X11, then you could make use of the Tk::InputO widget. This is basically a widget which takes input, but is invisible otherwise. You would put an InputO widget all over the application and put a cancel button on top of the InputO.