|
WireLess Studio Widgets Developer's Guide
|
|
ShowMessageBox
Displays a message box.
SHORT ShowMessageBox(LPCTSTR sText, LPCTSTR sCaption, LONG lOptions, LONG lDefaultButton, LONG lIcon);
Parameters
- sText
- The message to be displayed.
- sCaption
- The title of the message box.
- lOptions
- Specifies which option will be available for the user. If this parameter is zero, WS_MSG_BOX_OP_OK is used.
- lDefaultButton
- Indicates which button will receive the keyboard focus when the message box is displayed. If this parameter is zero, WS_MSG_BOX_DEFBUTTON1 is used.
- lIcon
- The icon to be displayed on the message box. If this parameter is zero no icon is displayed.
Return Value
On success, ShowMessageBox returns the selected option that can be one
following:
-
WS_MSG_BOX_RET_VAL_OK
-
WS_MSG_BOX_RET_VAL_CANCEL
-
WS_MSG_BOX_RET_VAL_ABORT
-
WS_MSG_BOX_RET_VAL_RETRY
-
WS_MSG_BOX_RET_VAL_IGNORE
-
WS_MSG_BOX_RET_VAL_YES
-
WS_MSG_BOX_RET_VAL_NO
On error ShowMessageBox returns
WS_MSG_BOX_RET_VAL_FAILED. To get extended information, call
WStError::GetLastErrorCode.
Remarks
The available options are:
-
WS_MSG_BOX_OP_ABORTRETRYIGNORE: Three pushbuttons are shown: Abort, Retry and Ignore.
-
WS_MSG_BOX_OP_OK: One pushbutton is shown: Ok.
-
WS_MSG_BOX_OP_OKCANCEL: Two pushbuttons are shown: Ok and Cancel.
-
WS_MSG_BOX_OP_RETRYCANCEL: Two pushbuttons are shown: Retry and Cancel.
-
WS_MSG_BOX_OP_YESNO: Two pushbuttons are shown: Yes and No.
-
WS_MSG_BOX_OP_YESNOCANCEL: Three pushbuttons are shown: Yes, No and Cancel.
To indicate which button should be default one, the following constants can be used:
-
WS_MSG_BOX_DEFBUTTON1: The keyboard focus is given to the first button.
-
WS_MSG_BOX_DEFBUTTON2: The keyboard focus is given to the second button.
-
WS_MSG_BOX_DEFBUTTON3: The keyboard focus is given to the third button.
-
WS_MSG_BOX_DEFBUTTON4: The keyboard focus is given to the fourth button.
The available icons are:
-
WS_MSG_BOX_ICON_EXCLAMATION: A exclamation mark icon is displayed
in the message box.
-
WS_MSG_BOX_ICON_INFORMATION: An icon consisting on an "i" in
a circle is displayed in the message box.
-
WS_MSG_BOX_ICON_QUESTION: A question mark icon is displayed in the message box.
-
WS_MSG_BOX_ICON_ERROR: A stop-sign icon is displayed in the
message box.
Example
using WirelessStudioOleWidgets;
WStForm oForm = new WStForm ();
oForm.ShowMessageBox("This is a test", "WStudio", (int)WSMsgBoxConstants.WS_MSG_BOX_OP_OKCANCEL, (int)WSMsgBoxConstants.WS_MSG_BOX_DEFBUTTON2,
(int)WSMsgBoxConstants.WS_MSG_BOX_ICON_EXCLAMATION);
Public wsForm As New WStForm
...
If sObjectName = "showMessageBoxBtn" Then
sMsgBoxTest = wsWidget.GetTextByName("msgBoxText")
sMsgBoxCaption = wsWidget.GetTextByName("msgBoxCaption")
iMsgBoxResult = wsForm.ShowMessageBox(sMsgBoxTest, sMsgBoxCaption, iOptions, iDefaultAs, iIcon)
wsWidget.SetTextByName "msgBoxResultLabel", "Result: " + MapResultValueToString(iMsgBoxResult)
End If
...
See also
ShowPopupMessage
WStWiget class reference |
WStForm class reference |
WStFactory class reference |
WStError class reference