Message Box
Message Box is a client control that requires interaction from the user in order for the work process to continue.
Variations
There are four types of Message Boxes: alert
, confirm
, inquire
and generic
.
When to use
Use Message Boxes when the user needs to make an active decision, or to bring something to the user's attention.
Alert: | Information to the user without possibility to rollback ( Cancel ) |
Confirm: | Information to the user with possibility to rollback ( Cancel ) |
Inquire: | Question to the user with options YES, NO or rollback ( Cancel ) |
Generic: | Custom options set by the developer (example) |
Limitations
The alert
, confirm
and inquire
message boxes only have customizable text - the buttons and icons cannot be set.
The generic
message box limits the icon selection to warning, information and question.
How to use
There are four command instructions or methods in commands for this: * alert
* confirm
* inquire
* messagebox
Each method takes a message.
The method messagebox
allows the user to set custom buttons, select icon and set a title. Icons available are warning information and question.
Messagebox
also gives a possibility to set preselected buttons. This setting is optional and if no button is marked as preselected,then messagebox
marks the first button from the left by default.
alert
command MessageBoxExample {
execute {
alert("Take note!");
}
}
Figure 1 - Alert Message Box.
confirm
command MessageBoxExample {
execute {
confirm("Confirm action") {
when OK {
doOkAction();
}
when CANCEL {
exit;
}
}
}
}
Figure 2 - Confirm Message Box.
inquire
command MessageBoxExample {
execute {
inquire("Do you want to do this?") {
when YES {
doYesAction();
}
when NO {
doNoAction();
}
when CANCEL {
exit;
}
}
}
}
Figure 3 - Inquire Message box.
generic
command MessageBoxExample {
execute {
messagebox("Optional Title", question, "This is a generic messagebox") {
when "Button1" {
doAction1();
selected = [true]; // this is the optional pre-selected button setting
}
when "Button2" {
doAction2();
}
}
}
}
Figure 4 - Generic Message Box.