5.4 Message dialog boxes

The AFXMessageDialog class extends the FXMessageDialog class by enforcing certain characteristics of the dialog box; for example, the window title and message symbol. These characteristics make message dialog boxes in ABAQUS/CAE consistent and easy to use. This section describes the message dialog boxes that you can create with the ABAQUS GUI Toolkit. The following topics are covered:


5.4.1 Error dialog boxes

You post error dialog boxes in response to a failure condition that the application cannot resolve.

Error dialog boxes have the following characteristics:

  • The application name is displayed in their title bar.

  • An error symbol is displayed on the left side of the dialog box.

  • The action area contains only a Dismiss button.

  • They are modal.

For example:

mainWindow = getAFXApp().getAFXMainWindow()
showAFXErrorDialog(mainWindow, 'An invalid value was supplied.')

Figure 5–1 An example of an error dialog box from showAFXErrorDialog.


5.4.2 Warning dialog boxes

You post warning dialog boxes in response to a condition that the application needs user assistance to resolve.

Warning dialog boxes have the following characteristics:

  • The application name is displayed in their title bar.

  • A warning symbol is displayed on the left side of the dialog box.

  • The action area may contain Yes, No, and Cancel buttons.

  • They are modal.

To find out which button in the warning dialog box was pressed by the user, you must pass the warning dialog box a target and a selector and you must create a message map entry in the form to handle that message. In your message handler you can query the warning dialog box using the getPressedButtonId method. The following examples illustrate how to create a warning dialog box:

You must define an ID in the form class:

from abaqusGui import *

class MyForm(AFXForm):
    [
        ID_WARNING,
    ] = range(AFXForm.ID_LAST, AFXForm.ID_LAST+1)

    def __init__(self, owner):

        # Construct the base class.
        #
        AFXForm.__init__(self, owner)
                
        FXMAPFUNC(self, SEL_COMMAND, self.ID_WARNING, 
            MyForm.onCmdWarning)
        ...

    def doCustomChecks(self):

        if <someCondition>:
            showAFXWarningDialog( self.getCurrentDialog(), 
                'Save changes made in the dialog?',
                AFXdialog.YES | AFXDialog.NO | AFXDialog.NO, 
                self, self.ID_WARNING)
            return FALSE
            
        return TRUE

     def onCmdWarning(self, sender, sel, ptr):
    
        if sender.getPressedButtonId() == \
            AFXDialog.ID_CLICKED_YES:
                self.issueCommands()
        elif sender.getPressedButtonId() == \
            AFXDialog.ID_CLICKED_NO:
                self.deactivate()

Figure 5–2 An example of a warning dialog box from showAFXWarningDialog.

There are two other variations of warning dialog boxes:

  • showAFXDismissableWarningDialog

  • showAFXItemsWarningDialog

The dialog box created by showAFXDismissableWarningDialog contains a check button that allows the user to specify whether the application should continue to post the warning dialog box each time the warning occurs. You can check the state of the button by calling the getCheckButtonState method of the warning dialog.

The dialog box created by showAFXItemsWarningDialog contains a scrolled list of items to be displayed to the user. The list prevents the dialog box from becoming too tall when it is displaying a long list of items.


5.4.3 Information dialog boxes

You post information dialog boxes to provide an explanatory message. Information dialog boxes have the following characteristics:

  • The application name is displayed in their title bar.

  • An information symbol is displayed on the left side of the dialog box.

  • The action area contains only a Dismiss button.

  • They are modal.

For example,
mainWindow = getAFXApp().getAFXMainWindow()
showAFXInformationDialog(
    mainWindow, 'This is an information dialog.')

Figure 5–3 An example of an information dialog box from showAFXInformationDialog.


5.4.4 Specialized message dialog boxes

If you need more flexibility than the standard message dialog boxes, you must derive a new dialog box from AFXDialog and provide the specialized handling. For more information, see Custom dialog boxes, Section 5.5.