BPS Script API  2.24.4
bps::gui::MessageBox Class Reference

A class to display message boxes. More...

Public Types

enum  Button {
  NoButton = 0 , Ok = 0x00000400 , Save = 0x00002000 , SaveAll = 0x00001000 , Open = 0x00002000 , Yes = 0x00004000 , YesToAll = 0x00008000 , No = 0x00010000 , NoToAll = 0x00020000 , Abort = 0x00040000 ,
  Retry = 0x00080000 , Ignore = 0x00100000 , Close = 0x00200000 , Cancel = 0x00400000 , Discard = 0x00800000 , Help = 0x01000000 , Apply = 0x02000000 , Reset = 0x04000000 , RestoreDefaults = 0x08000000
}
 Buttom identifiers. More...
 
enum  Icon { NoIcon = 0 , Information = 1 , Warning = 2 , Critical = 3 , Question = 4 }
 Icon identifiers. More...
 
enum  Result { Rejected = 0 , Accepted = 1 }
 Result codes. More...
 

Signals

void accepted ()
 This signal is emitted when the dialog has been accepted either by the user or by calling accept() or done() with the Accepted argument.
 
void finished (Result aResult)
 This signal is emitted when the dialog's result code has been set, either by the user or by calling done(), accept(), or reject(). More...
 
void rejected ()
 This signal is emitted when the dialog has been rejected either by the user or by calling reject() or done() with the Rejected argument.
 

Public Member Functions

void accept ()
 Hides the modal dialog and sets the result code to Accepted.
 
void done (Result aResult)
 Closes the dialog and sets its result code to aRetcode. More...
 
Result exec ()
 Shows the dialog as a modal dialog, blocking until the user closes it. More...
 
 MessageBox (Widget aParent=0)
 Constructor. More...
 
void reject ()
 Hides the modal dialog and sets the result code to Rejected.
 
void show ()
 Shows the dialog non-modal.
 

Static Public Member Functions

static Button critical (Widget aParent, String aTitle, String aText, Buttons aButtons=Ok, Button aDefaultButton=Ok)
 Display a message box with error icon and sound. More...
 
static Button information (Widget aParent, String aTitle, String aText, Buttons aButtons=Ok, Button aDefaultButton=Ok)
 Display a message box with information icon and sound. More...
 
static Button question (Widget aParent, String aTitle, String aQuestion, Buttons aButtons=(Yes+No), Button aDefaultButton=No)
 Display a message box with question icon and sound. More...
 
static Button warning (Widget aParent, String aTitle, String aText, Buttons aButtons=Ok, Button aDefaultButton=Ok)
 Display a message box with warning icon and sound. More...
 

Properties

String detailedText
 This property holds the text to be displayed in the details area. More...
 
Icon icon
 This property holds the message box's icon. More...
 
String informativeText
 This property holds the informative text that provides a fuller description for the message. More...
 
Buttons standardButtons
 This property holds collection of standard buttons in the message box. More...
 
String text
 This property holds the message box text to be displayed. More...
 

Detailed Description

A class to display message boxes.

The static functions information, warning, critical and question are available for convenient usage without creating an object.

importExtension('bps.gui');
with (bps.gui) {
// static example
function display(result)
{
MessageBox.information(0, 'You clicked:', result);
}
// object example
var m = new MessageBox;
m.icon = MessageBox.Question;
m.windowTitle = 'foo';
m.text = 'bar?';
m.standardButtons = MessageBox.Save + MessageBox.Discard;
m.finished.connect(display);
m.show();
}
void importExtension(String aExtensionName)
Imports the named extension into the script engine.
MessageBox(Widget aParent=0)
Constructor.
The bps.gui extension is a namespace assembling GUI properties and functions.
Definition: bps.gui.js:24
The bps extension is a namespace assembling general BPS properties and functions.
Definition: bps.AsyncIO.js:1

Member Enumeration Documentation

◆ Button

Buttom identifiers.

Enumerator
NoButton 

No button at all.

Used as default button parameter in the static methods to let the MessageBox decide itself which shall be the default button.

Ok 

OK button.

Save 

Save button.

SaveAll 

Save All button.

Open 

Open button.

Yes 

Yes button.

YesToAll 

Yes to All button.

No 

No button.

NoToAll 

No to all button.

Abort 

Abort button.

Retry 

Retry button.

Ignore 

Ignore button.

Close 

Close button.

Cancel 

Cancel button.

Discard 

Discard button.

Help 

Help button.

Apply 

Apply button.

Reset 

Reset button.

RestoreDefaults 

Restore Defaults button.

◆ Icon

Icon identifiers.

Enumerator
NoIcon 

No icon at all.

Information 

Information icon.

Warning 

Warning icon.

Critical 

Critical error icon.

Question 

Question icon.

◆ Result

Result codes.

Enumerator
Rejected 

Dialog was rejected.

Accepted 

Dialog was accepted.

Constructor & Destructor Documentation

◆ MessageBox()

bps::gui::MessageBox::MessageBox ( Widget  aParent = 0)

Constructor.

Parameters
aParentParent widget, or 0 if no parent.

Member Function Documentation

◆ critical()

static Button bps::gui::MessageBox::critical ( Widget  aParent,
String  aTitle,
String  aText,
Buttons  aButtons = Ok,
Button  aDefaultButton = Ok 
)
static

Display a message box with error icon and sound.

Parameters
aParentParent widget, or 0 if there is no parent.
aTitleThe text to display in the window title bar.
aTextThe message displayed within the message box. May be formatted with HTML.
aButtonsAdded codes of the buttons to display.
aDefaultButtonWhat button is the default one.
Returns
The button that was pressed.

◆ done()

void bps::gui::MessageBox::done ( Result  aResult)

Closes the dialog and sets its result code to aRetcode.

If this dialog is shown with exec(), done() causes the local event loop to finish, and exec() to return aRetcode. If the dialog is the application's main widget, the application terminates.

Parameters
aResultResult code (Accepted, Rejected or Button)

◆ exec()

Result bps::gui::MessageBox::exec ( )

Shows the dialog as a modal dialog, blocking until the user closes it.

Returns
Accepted, Rejected or a Button.

◆ finished

void bps::gui::MessageBox::finished ( Result  aResult)
signal

This signal is emitted when the dialog's result code has been set, either by the user or by calling done(), accept(), or reject().

Parameters
aResultResult code (Accepted, Rejected or Button)

◆ information()

static Button bps::gui::MessageBox::information ( Widget  aParent,
String  aTitle,
String  aText,
Buttons  aButtons = Ok,
Button  aDefaultButton = Ok 
)
static

Display a message box with information icon and sound.

Parameters
aParentParent widget, or 0 if there is no parent.
aTitleThe text to display in the window title bar.
aTextThe message displayed within the message box. May be formatted with HTML.
aButtonsAdded codes of the buttons to display.
aDefaultButtonWhat button is the default one.
Returns
The button that was pressed.

◆ question()

static Button bps::gui::MessageBox::question ( Widget  aParent,
String  aTitle,
String  aQuestion,
Buttons  aButtons = (Yes+No),
Button  aDefaultButton = No 
)
static

Display a message box with question icon and sound.

Parameters
aParentParent widget, or 0 if there is no parent.
aTitleThe text to display in the window title bar.
aQuestionThe question displayed within the message box. May be formatted with HTML.
aButtonsAdded codes of the buttons to display.
aDefaultButtonWhat button is the default one.
Returns
The button that was pressed.
var r = MessageBox.question(0, 'What now', 'Do you want to proceed?');
if (r == MessageBox.Yes) {
...

◆ warning()

static Button bps::gui::MessageBox::warning ( Widget  aParent,
String  aTitle,
String  aText,
Buttons  aButtons = Ok,
Button  aDefaultButton = Ok 
)
static

Display a message box with warning icon and sound.

Parameters
aParentParent widget, or 0 if there is no parent.
aTitleThe text to display in the window title bar.
aTextThe message displayed within the message box. May be formatted with HTML.
aButtonsAdded codes of the buttons to display.
aDefaultButtonWhat button is the default one.
Returns
The button that was pressed.

Property Documentation

◆ detailedText

String bps::gui::MessageBox::detailedText
readwrite

This property holds the text to be displayed in the details area.

The text will be interpreted as a plain text. The default value of this property is an empty string.

◆ icon

Icon bps::gui::MessageBox::icon
readwrite

This property holds the message box's icon.

 

◆ informativeText

String bps::gui::MessageBox::informativeText
readwrite

This property holds the informative text that provides a fuller description for the message.

Infromative text can be used to expand upon the text() to give more information to the user. On the Mac, this text appears in small system font below the text(). On other platforms, it is simply appended to the existing text.

◆ standardButtons

Buttons bps::gui::MessageBox::standardButtons
readwrite

This property holds collection of standard buttons in the message box.

It controls which buttons are used by the message box.

◆ text

String bps::gui::MessageBox::text
readwrite

This property holds the message box text to be displayed.

The text will be interpreted either as a plain text or as rich text.


The documentation for this class was generated from the following file: