In GXT, MessageBox
methods are asynchronous, meaning that the application does not "lock up" while the message box is displayed.
I using a KeyListener
to process enter key presses in a form (to increase usability, i.e., allowing the form to be submitted by the enter key) and subsequently disabling the form fields while the application processes the user's credentials. If they are incorrect, I show a MessageBox.alert()
and then re-enable the form fields. However, since alert()
returns immediately, the form fields are immediately made available again, allowing the user to input data without closing the alert.
The solution is to use a callback in alert()
; however, the enter keypress not only causes the form to submit, but also causes the alert to immediately dismiss (as if both the form and the message box are processing the enter key). How do I keep the alert box open until the user presses enter a second time or clicks the "Ok" button?