lostFocus vs Clear Button

Forums for specific tips, techniques and example code
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

lostFocus vs Clear Button

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:10 pm

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

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: lostFocus vs Clear Button

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:10 pm

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


Return to “Tips and Techniques”

Who is online

Users browsing this forum: No registered users and 1 guest