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:
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.')
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, 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()
There are two other variations of warning dialog boxes:
showAFXDismissableWarningDialog
showAFXItemsWarningDialog
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.
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.
mainWindow = getAFXApp().getAFXMainWindow() showAFXInformationDialog(mainWindow, 'This is an information dialog.')
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.