User Tools

Site Tools


DzMessageBox

Script 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

A global static object available via the Global::MessageBox variable.

This object 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=“” )

Displays a modal “critical” message box to the user.

Parameter(s):

  • text - The text that is shown in the body of the message box.
  • title - The title the message box.
  • button0 - The text of button 0 - default text is used if empty.
  • button1 - The text of button 1 - button is omitted if empty (default).
  • button2 - The text of button 2 - button is omitted if empty (default).

Return Value:

  • 0 if the application is not showing prompts and the text of only one button is defined. 0 if the message is displayed to the user and the Esc key is pressed. Otherwise, the index of the button that the user pressed (i.e., 0, 1, or 2).

Attention:

  • If the application is not showing prompts and only one button would be shown, calls to this method will not cause a message to be shown to the user, rather the information that would have been presented to the user will be written to the application log. Further, if the application is not showing prompts and more than one button would be shown, calls to this method will result in an error being thrown, the information that would have been presented to the user being written to the application log, and the application instance to exit.

See Also:


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

Displays a modal “information” message box to the user.

Parameter(s):

  • text - The text that is shown in the body of the message box.
  • title - The title the message box.
  • button0 - The text of button 0 - default text is used if empty.
  • button1 - The text of button 1 - button is omitted if empty (default).
  • button2 - The text of button 2 - button is omitted if empty (default).

Return Value:

  • 0 if the application is not showing prompts and the text of only one button is defined. 0 if the message is displayed to the user and the Esc key is pressed. Otherwise, the index of the button that the user pressed (i.e., 0, 1, or 2).

Attention:

  • If the application is not showing prompts and only one button would be shown, calls to this method will not cause a message to be shown to the user, rather the information that would have been presented to the user will be written to the application log. Further, if the application is not showing prompts and more than one button would be shown, calls to this method will result in an error being thrown, the information that would have been presented to the user being written to the application log, and the application instance to exit.

See Also:


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

Displays a modal “question” message box to the user.

Parameter(s):

  • text - The text that is shown in the body of the message box.
  • title - The title the message box.
  • button0 - The text of button 0 - default text is used if empty.
  • button1 - The text of button 1 - button is omitted if empty.
  • button2 - The text of button 2 - button is omitted if empty (default).

Return Value:

  • 0 if the application is not showing prompts and the text of only one button is defined. 0 if the message is displayed to the user and the Esc key is pressed. Otherwise, the index of the button that the user pressed (i.e., 0, 1, or 2).

Attention:

  • If the application is not showing prompts and only one button would be shown, calls to this method will not cause a message to be shown to the user, rather the information that would have been presented to the user will be written to the application log. Further, if the application is not showing prompts and more than one button would be shown, calls to this method will result in an error being thrown, the information that would have been presented to the user being written to the application log, and the application instance to exit.

See Also:


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

Displays a modal “warning” message box to the user.

Parameter(s):

  • text - The text that is shown in the body of the message box.
  • title - The title the message box.
  • button0 - The text of button 0 - default text is used if empty.
  • button1 - The text of button 1 - button is omitted if empty.
  • button2 - The text of button 2 - button is omitted if empty (default).

Return Value:

  • 0 if the application is not showing prompts and the text of only one button is defined. 0 if the message is displayed to the user and the Esc key is pressed. Otherwise, the index of the button that the user pressed (i.e., 0, 1, or 2).

Attention:

  • If the application is not showing prompts and only one button would be shown, calls to this method will not cause a message to be shown to the user, rather the information that would have been presented to the user will be written to the application log. Further, if the application is not showing prompts and more than one button would be shown, calls to this method will result in an error being thrown, the information that would have been presented to the user being written to the application log, and the application instance to exit.

See Also: