_MESSAGEBOX (function)

From QB64 Phoenix Edition Wiki
Revision as of 22:56, 27 October 2022 by A740g (talk | contribs) (Initial version)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The _MESSAGEBOX function displays a message dialog box, which presents a message and returns the button id clicked by the user. The return value can be 0 for "cancel"/"no", 1 for "ok"/"yes", 2 for "no" in "yesnocancel".


Syntax

result& = _MESSAGEBOX(title$, message$, dialogType$, iconType$[, defaultButton&])


Parameters

  • title$ is the dialog box title
  • message$ is the dialog box message
  • dialogType$ is the dialog box type and shows different buttons based on the value (this can be "ok", "okcancel", "yesno", or "yesnocancel")
  • iconType$ is the icon type that is displayed inside the dialog box (this can be "info", "warning", or "error")
  • defaultButton& can be 0 for "cancel"/"no", 1 for "ok"/"yes", 2 for "no" in "yesnocancel"
  • All parameters accept an empty string ("") in which case system defaults are used


Description

  • The dialog box automatically becomes a modal window if the application window is visible
  • "ok", "okcancel", "yesno", or "yesnocancel" are expected to be in lower case
  • "info", "warning", or "error" are expected to be in lower case


Availability

  • QB64-PE v3.4 and up


Examples

Example
Hello, world with common dialogs
IF _MESSAGEBOX("My Cool App", "Do you want to hear a beep?", "yesno", "question") = 1 THEN
    BEEP
ELSE
    _MESSAGEBOX "My Cool App", "The sound of silence."
END IF


See also



Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link