User Tools

Site Tools


DzMessageBox

DAZScript wrapper for QMessageBox.

More...

Inherits :

Methods

DAZ Script
Numbercritical ( String text, String title, String button0, String button1=“”, String button2=“” )
Numberinformation ( String text, String title, String button0, String button1=“”, String button2=“” )
Numberquestion ( String text, String title, String button0, String button1, String button2=“” )
Numberwarning ( String text, String title, String button0, String button1, String button2=“” )

Detailed Description

The DzMessageBox class is available in DAZScript via Global::MessageBox.

It provides functions that display pre-built message boxes to the user. This is the easiest way for a script to interact with a user - simply call one of the functions as shown in the following examples:

Example:

Display an information box with an 'Ok' button

MessageBox.information( qsTr("MyScript finished successfully."), qsTr("MyScript"), qsTr("&OK") );

Example:

Ask the user a question with 'Yes'/'No' buttons

if( MessageBox.question( qsTr("Do you want to reset the entire figure?"), qsTr("MyScript"), qsTr("&Yes"), qsTr("&No") ) == 0 ){
	resetEntireFigure();
}

Example:

Display a warning message to the user

if( MessageBox.warning( qsTr("If you continue, the entire figure will be reset!"), qsTr("MyScript"), qsTr("&OK"), qsTr("&Cancel") ) == 1 ){
	return;
}

Example:

Display a critical message to the user

var error = doSomething();
if( error != 0 ){
	MessageBox.critical( qsTr("The script has encountered a critical error!"), qsTr("MyScript"), qsTr("&OK") );
	return;
}

Methods


Number : critical( String text, String title, String button0, String button1=“”, String button2=“” )

Shows a critical dialog box to the user.

Parameter(s):

  • text - The text that is shown in the body of the dialog.
  • title - The title of the dialog.
  • button0 - The text of button 0.
  • button1 - The text of button 1 (if empty, no button will be shown).
  • button2 - The text of button 2 (if empty, no button will be shown).

Return Value:

  • The index of the button that the user pressed (0, 1, or 2)

Number : information( String text, String title, String button0, String button1=“”, String button2=“” )

Shows an information dialog box to the user.

Parameter(s):

  • text - The text that is shown in the body of the dialog.
  • title - The title of the dialog.
  • button0 - The text of button 0.
  • button1 - The text of button 1 (if empty, no button will be shown).
  • button2 - The text of button 2 (if empty, no button will be shown).

Return Value:

  • The index of the button that the user pressed (0, 1, or 2).

Number : question( String text, String title, String button0, String button1, String button2=“” )

Shows a question dialog box to the user.

Parameter(s):

  • text - The text that is shown in the body of the dialog.
  • title - The title of the dialog.
  • button0 - The text of button 0.
  • button1 - The text of button 1.
  • button2 - The text of button 2 (if empty, no button will be shown).

Return Value:

  • The index of the button that the user pressed (0, 1, or 2).

Number : warning( String text, String title, String button0, String button1, String button2=“” )

Shows a warning dialog box to the user.

Parameter(s):

  • text - The text that is shown in the body of the dialog.
  • title - The title of the dialog.
  • button0 - The text of button 0.
  • button1 - The text of button 1.
  • button2 - The text of button 2 (if empty, no button will be shown).

Return Value:

  • The index of the button that the user pressed (0, 1, or 2).