Page 1 of 1

lostFocus vs Clear Button

Posted: Fri Aug 07, 2009 2:10 pm
by ConvertFromOldNGs
by JADE News Administrator >> Thu, 29 Oct 1998 5:04:17 GMT

I have a form where I wish to validate the data when the user moves from a textbox. I'm using lostFocus which works fine unless the user wishes to hit the Clear or Close button when there's invalid data in the text box. The lostFocus method is actioned before the Clear Button. Is there anyway that lostFocus can detect that another function has been selected and hence ignore any editing etc.

cheers
Adrian

Re: lostFocus vs Clear Button

Posted: Fri Aug 07, 2009 2:10 pm
by ConvertFromOldNGs
by JADE News Administrator >> Thu, 29 Oct 1998 5:04:47 GMT

Due to the nature of windows events, I think you'll find that the gotFocus event of the control the User is moving to is fired, *before* the lostFocus event of the control the User is moving from (that may sound weird, but when you think about it, it makes sense).

Therefore, you should be able to clear the contents of the problematic textBox from within the gotFocus event.
--
Darrell Duniam
dduniam@cardinal.co.nz