Dismissing a WebDialog too fast

I have a WebDialog with a text field and an OK button. The text field has a TextChanged event handler, and the OK button calls self.Close in its Action handler. The problem is that, if I click the OK button immediately after changing the text field, the TextChanged event isn’t fired and the text field does not register the change (i.e. reading the text field contents in the Dismissed event handler does not help - the changed text never made it back to the server.

How can I ensure that any changes to text fields are registered before the dialog is closed? I can “resolve” the issue on my system by putting a delay after clicking OK before closing the dialog. However, on a bad connection or loaded-down server, I don’t know what the response is going to be.

How about starting with the button disabled and enable it in the text changed event?

Well, I kinda simplified things - I have several text fields. But even if I had one, if I enter some text, wait until the OK button enables, and then quickly type some more and click - the newly-entered text goes AWOL. So, no, that isn’t the solution.

I’m surprised this hasn’t been seen as an issue before. Or perhaps it has and I missed it.

[quote=155713:@Paul Rodman]Well, I kinda simplified things - I have several text fields. But even if I had one, if I enter some text, wait until the OK button enables, and then quickly type some more and click - the newly-entered text goes AWOL. So, no, that isn’t the solution.

I’m surprised this hasn’t been seen as an issue before. Or perhaps it has and I missed it.[/quote]

Maybe you could simply set a flag in your button and close at the end of the TextChange event if the flag is set ?

Yes, but I don’t know that the text has changed until I get a TextChanged or KeyDown event firing.