Is there anyway to let messagebox not to close when hit Enter on keyboard? RRS feed

  • Question

  • Dear all,

    I got a situation with one of our software using scanner. On every scan, it will send an Enter keyboard hit event. But in our program, if the barcode scanned not valid, it will pop up a messagebox to say it is invalid.
    What happened in reality is, if user did not see that messagebox, they just keep scanning. When the next scan comes, the Enter event from the scanner closed that messagebox automatically. So a lot of times, user did not even notice that messagebox at all.
    So, I am wondering if there is a way to let the messagebox not to close on Enter keyboard event. We want user has to click the ok button with mouse. Is that possible to change this default behavior on messagebox ok button? Or better just to create my own window to act like a messagebox?

    Friday, February 5, 2010 5:25 PM


  •  Or better just to create my own window to act like a messagebox?

    This would be my preference, for two reasons.

    1) It's very easy to implement the behavior you way - just don't set a default button.

    2) I would, personally, make this look similar to a message box, but subtlety different.  You are changing the default behavior of the dialog you're generating, so having it look like a standard dialog would cause some confusion in terms of usability.  Making this slightly non-standard in appearance (perhaps a different message like "Click Here to Continue" on a large button below the error would make it more obvious that this doesn't behave as a standard message box).

    Reed Copsey, Jr. - http://reedcopsey.com
    • Proposed as answer by Nikita Leontiev Friday, February 5, 2010 10:11 PM
    • Marked as answer by Wesley Yao Thursday, February 11, 2010 2:48 AM
    Friday, February 5, 2010 5:33 PM