Page 338 -
P. 338
exceptions and message boxes
A message box demands attention
Most of the time, GUI programs put the user in charge. If the user chooses
to click a button or edit a field, the computer lets them do just that in
whatever order and at whatever time the user chooses. But sometimes, GUI
programs need to stop the user and ask her a question, getting her to confirm
or acknowledge something. That’s where message boxes come in.
A message box is something that requires a response, which is why it’s
sometimes called a dialog box.
The simplest message box displays a message with a single OK button:
This icon shows
it's a warning. This is the message.
The user must click the “OK” button
to continue, indicating that she
acknowledges the message.
A message box always displays the message in a separate window, typically
in front of your main GUI window. And it won’t go away until you click
it, dismissing it. That’s why message boxes are the most commonly used way
of displaying errors. The user has to read and respond to the error before
continuing.
You should be sparing in how often you display message boxes, because if
users see too many of them, they are likely to click them without reading the
message. But, when used carefully, they keep your user informed and alert.
you are here 4 303