Class WMessageBox


public class WMessageBox
extends WDialog
A standard dialog for confirmation or to get simple user input.

The messagebox shows a message in a dialog window, with a number of buttons. These buttons may be standard buttons, or customized.

A messagebox is (usually) modal, and can be instantiated synchronously or asynchronously.

When using a messagebox asynchronously, there is no API call that waits for the messagebox to be processed. Instead, the usage is similar to instantiating a WDialog (or any other widget). You need to connect to the buttonClicked() signal to interpret the result and delete the message box.

The synchronous use of a messagebox involves the use of the static WWidget.show() method, which blocks the current thread until the user has processed the messabebox. Since this uses the WDialog#exec(), it suffers from the same scalability issues as well as limitations. See documentation of WDialog for more details.

This will show a message box that looks like this:

Example of a WMessageBox (default)

Example of a WMessageBox (polished)

i18n

The strings used in the WMessageBox buttons can be translated by overriding the default values for the following localization keys:

  • Wt.WMessageBox.Abort: Abort
  • Wt.WMessageBox.Cancel: Cancel
  • Wt.WMessageBox.Ignore: Ignore
  • Wt.WMessageBox.No: No
  • Wt.WMessageBox.NoToAll: No to All
  • Wt.WMessageBox.Ok: Ok
  • Wt.WMessageBox.Retry: Retry
  • Wt.WMessageBox.Yes: Yes
  • Wt.WMessageBox.YesToAll: Yes to All