Dialog - hpi-swa-teaching/MaterialDesignWidgets GitHub Wiki
class MDDialog
You can create a dialog by simply calling MDDialog new openInHand.
This will show a dialog without any content.
To create a basic MDDialog you might want to use something like the following:
MDDialog new
title: 'Basic Dialog';
text: 'This is just a basic dialog.';
positiveText: 'OK';
openInHand.
This will also create two buttons at the bottom of the dialog.
By clicking on Cancel the dialog automatically closes itself.
Opening a Dialog
MDDialog has a method for opening itself open and one for closing close.
A typical use case would be opening a custom dialog when a special event happens (e.g. a Click-Event). Therefore you might want to use the following code:
| dialog |
dialog := MDDialog new
title: 'Reset settings?';
content: 'This will reset your device to its default factory settings.';
positiveText: 'Accept';
negativeText: 'Cancel';
showNegative: true;
yourself.
MDContainedButton new
text: 'Open Dialog';
target: [ dialog open ];
actionSelector: #value;
openInHand
Customizing a MDDialog
General
title: aStringset the title of the dialogtext: aStringset the body text of the dialogcontent: aStringOrSymbolset the body of the dialog
Dismissing Dialogs
autoDismiss: aBooleanclose the dialog when clicking positive buttondefault: truedismissOnBackgroundClick: aBooleanclose the dialog when clicking on backgrounddefault: true
Open and Close
openopen the dialogcloseclose the dialog
Positive Button
positiveText: aStringset the positive button's textonPositive: aBlockset the block which will be evaluated when positive button is clicked
Negative Button
showNegative: aBooleandefine whether the negative button should be shown or notdefault: falsenegativeText: aStringset the negative button's textonNegative: aBlockset the block which will be evaluated when negative button is clicked