0

I wrote an application, where the user filled in a form with some text and pressed enter when a textbox is filled. After this some checks were done and a nominal MessageBos with an OK-Button appeared. Some useres didn't read the messagebox, typed in as there were in the next textbox, pressed the OK-Button and the warning/error-message disappeared without reading.

I know, I cannot to control, that the user really read the message, but I want, that the usere use the mouse for conforming. Is there a way, that the Ok-button doesn't have the focus when the messagebox is shown ? Or do I have to write my Own Messagebox with an extra field, that has the focus.

Christoph Fink
  • 22,727
  • 9
  • 68
  • 113
  • If the message is that important, you should just stop whatever your code does when you press enter on the textbox and then eventually your user will get the idea – Sayse May 21 '14 at 12:36
  • 2
    If you're trying to do input validation, there might be better ways than popping up a MessageBox to tell the user about errors. You could try the approach outlined here, which uses the built in Validation framework: http://stackoverflow.com/a/8915207/2609288 – Baldrick May 21 '14 at 12:37
  • 1
    Your proposed solution will just irritate a *different* set of users. It doesn't really solve the problem, it just moves it around. The real issue is displaying a message box when validation fails. That's *horrible* UI, done only by the most user-hostile applications. Change your notification strategy to a tooltip, balloon tip, a magically appearing label control, or just about anything else. It will be no more work than hacking MessageBox, and you'll get a lot more bang for your buck. – Cody Gray - on strike May 21 '14 at 12:39
  • 1
    This is an appalling idea. There are people in the world that find mice hard to use. There are people that prefer not to use mice. Why do you want to make them suffer? – David Heffernan May 21 '14 at 12:39

1 Answers1

1

While protecting users from themselves is typically a no-win endeavor, I would suggest that to do what you want would require you to construct a form of your own in which you could capture the keyboard input and disallow the dismissal of the dialog when the Enter key is pressed.

DonBoitnott
  • 10,787
  • 6
  • 49
  • 68
  • capturing or intercepting (and overriding) keyboard input does not necessarily require you to write a form of your own http://stackoverflow.com/a/23286790/2186023 – DrCopyPaste May 21 '14 at 12:41
  • @DrCopyPaste Of course not. But forms are cheap and easy to construct with nowhere near the understanding that that code requires. – DonBoitnott May 21 '14 at 13:16
  • true, I didn't mean to say that you implied that it is necessary, just wanted to add this possibility – DrCopyPaste May 21 '14 at 13:30