Using KILL_FOCUS for validation with a 'Cancel' button.

I have a form where I let the user input a lot of data. I want to be
able to fill parts of the form based on what the user enters in the
first few text-ctrls. So, I trap the KILL_FOCUS of those text-ctrl
widgets.

I also have a 'Cancel' button in the form to cancel the operation.

The problem is that: when the focus is in one of the text-ctrl widgets
(whose KILL_FOCUS is being handled), and the user clicks on 'Cancel'
button, the KILL_FOCUS gets called and it annoys the user to enter a
valid value before handling the 'Cancel' button's click event.

What is the best way to fix this?

···

--
Joe Steeve
HiPro IT Solutions Pvt. Ltd.
http://hipro.co.in/

Joe Steeve wrote:

I have a form where I let the user input a lot of data. I want to be
able to fill parts of the form based on what the user enters in the
first few text-ctrls. So, I trap the KILL_FOCUS of those text-ctrl
widgets.

I also have a 'Cancel' button in the form to cancel the operation.

The problem is that: when the focus is in one of the text-ctrl widgets
(whose KILL_FOCUS is being handled), and the user clicks on 'Cancel'
button, the KILL_FOCUS gets called and it annoys the user to enter a
valid value before handling the 'Cancel' button's click event.

What is the best way to fix this?

It might not be a perfect fit with what you are trying to do, but I'd take a look at Validators.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!