This class is the abstract superclass of the classes
that represent the built in platform dialogs.
A Dialog typically contains other widgets
that are not accessible. A Dialog is not
a Widget.
This class can also be used as the abstract superclass
for user-designed dialogs. Such dialogs usually consist
of a Shell with child widgets. The basic template for a
user-defined dialog typically looks something like this:
public class MyDialog extends Dialog {
Object result;
public MyDialog (Shell parent, int style) {
super (parent, style);
}
public MyDialog (Shell parent) {
this (parent, 0); // your default style bits go here (not the Shell's style bits)
}
public Object open () {
Shell parent = getParent();
Shell shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
shell.setText(getText());
// Your code goes here (widget creation, set result, etc).
shell.open();
Display display = parent.getDisplay();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
return result;
}
}
Note: The modality styles supported by this class
are treated as HINTs, because not all are supported
by every subclass on every platform. If a modality style is
not supported, it is "upgraded" to a more restrictive modality
style that is supported. For example, if PRIMARY_MODAL
is not supported by a particular dialog, it would be upgraded to
APPLICATION_MODAL. In addition, as is the case
for shells, the window manager for the desktop on which the
instance is visible has ultimate control over the appearance
and behavior of the instance, including its modality.
Styles:
APPLICATION_MODAL, PRIMARY_MODAL, SYSTEM_MODAL
Events:
(none)
Note: Only one of the styles APPLICATION_MODAL, PRIMARY_MODAL,
and SYSTEM_MODAL may be specified.
Dialogtypically contains other widgets that are not accessible. ADialogis not aWidget.This class can also be used as the abstract superclass for user-designed dialogs. Such dialogs usually consist of a Shell with child widgets. The basic template for a user-defined dialog typically looks something like this:
Note: The modality styles supported by this class are treated as HINTs, because not all are supported by every subclass on every platform. If a modality style is not supported, it is "upgraded" to a more restrictive modality style that is supported. For example, if
PRIMARY_MODALis not supported by a particular dialog, it would be upgraded toAPPLICATION_MODAL. In addition, as is the case for shells, the window manager for the desktop on which the instance is visible has ultimate control over the appearance and behavior of the instance, including its modality.Note: Only one of the styles APPLICATION_MODAL, PRIMARY_MODAL, and SYSTEM_MODAL may be specified.