Re: focusLost vs. actionPerformed
- From: "Fred Kleinschmidt" <fred.l.kleinmschmidt@xxxxxxxxxx>
- Date: Tue, 26 Sep 2006 21:00:34 GMT
"Richard F.L.R.Snashall" <rflrs@xxxxxxxxxxxxx> wrote in message
news:6d2dneT5vYzf6YTYnZ2dnUVZ_u2dnZ2d@xxxxxxxxxx
Fred Kleinschmidt wrote:Say, for example you have 5 text fields and an OK button.
"Richard F.L.R.Snashall" <rflrs@xxxxxxxxxxxxx> wrote in message
Popping a error/warning dialog on FocusLost is usually a *bad idea*.
The problem is that the user starts entering the info, then realizes she
has to look elsewhere to view information necessary to input the
correct info. But when she tries that, bang! - you force thiis dialog
up, she acknowledges it, and you send focus back to the offending
text field. Then she tries to go elsewhere to find the info, and you pop
up
the dialog again. She in frustration then abandons anything to do with
that program.
In its present state, I do not force the focus back to the offending
component. I basicly ignore the bad input by putting the good value
back. This does not allow the user to just edit it to a good value,
but it does preclude the problem above.
However, if I don't check the input when focus is lost, (or do you
have an alternative), it could sit there in a poor state with no
message to the user. Wouldn't that be just as poor?
The actionPerformed of the button then checks all fields and
either performs whatever is supposed to happen (if all is OK), or
reports all errors.
I really dislike it when an error dialog pops up due to a focus lost event.
What if I am entering info and I notice that I have received an important
email?
I go to read it and - bam! - here comes this stupid dialog.
That still leaves the original question. Is it a property of my
machine that the loss of focus is acted upon before the other
actionPerformed process has completed, or would that happen on all
platforms?
When you press the acknowledge button on the dialog, this happens:
1)The item that had focus gets a focus lost (unless it was this button).
2)The button gets a focus gained (if it didn't already have it)
3) The button redraws itself as pushed
Then when you release the button,
4) actionPerformed
5) the button redraws itself in its un-pushed state
Actually, there are several other events happening, too (mouse motion,
leave, enter, etc.)
--
Fred L. Kleinschmidt
Boeing Associate Technical Fellow
Technical Architect, Software Reuse Project
.
- References:
- focusLost vs. actionPerformed
- From: Richard F.L.R.Snashall
- Re: focusLost vs. actionPerformed
- From: Fred Kleinschmidt
- Re: focusLost vs. actionPerformed
- From: Richard F.L.R.Snashall
- focusLost vs. actionPerformed
- Prev by Date: Re: focusLost vs. actionPerformed
- Next by Date: Layouts. Which to use, and when/
- Previous by thread: Re: focusLost vs. actionPerformed
- Next by thread: Re: focusLost vs. actionPerformed
- Index(es):