int wb_message_box (int parent, string message [, string title [, int style]])
Creates and displays a message box under the style supplied and returns a value according to the button pressed.
The following styles are defined in WinBinder:
| Value for style |
What is displayed |
|---|---|
|
WBC_OK (the default) |
An OK button. |
|
WBC_INFO |
An information icon and an OK button. |
|
WBC_WARNING |
An exclamation point icon and an OK button. |
|
WBC_STOP |
A stop icon and an OK button. |
|
WBC_QUESTION |
A question mark icon and an OK button. |
|
WBC_OKCANCEL |
A question mark icon, an OK button and a Cancel button. |
|
WBC_YESNO |
A question mark icon, a Yes button and a No button. |
|
WBC_YESNOCANCEL |
A question mark icon, a Yes button, a No button and a Cancel button. |
NOTE
The style parameter accepts all styles available to the Windows function MessageBox().
See the following table.
| Button pressed |
Return value |
|---|---|
|
OK |
TRUE |
|
Retry |
TRUE |
|
Yes |
TRUE |
|
No |
0 (zero)¹ |
|
Cancel |
FALSE |
|
Ignore |
FALSE |
|
Abort |
FALSE |
|
(Others) |
FALSE |
|
(Error) |
NULL |
¹ The value the No button returns is zero to differentiate it from the other negative values. This distinction is only necessary when you use the WBC_YESNOCANCEL style. See the example below.
// Asks for confirmation before closing an application window
function process_main($window, $id)
{
switch($id) {
case ID_EXIT:
case IDCLOSE:
if(wb_message_box($window, "Are your sure?", APPNAME, WBC_YESNO))
wb_destroy_window($window);
break;
}
}
// The code snippet below differentiates between
buttons No and Cancel |