Skip to content

Dialog

dialog-example.slint
import { StandardButton, Button } from "std-widgets.slint";
export component Example inherits Dialog {
Text {
text: "This is a dialog box";
}
StandardButton { kind: ok; }
StandardButton { kind: cancel; }
Button {
text: "More Info";
dialog-button-role: action;
}
}
dialog example

Dialog is like a window, but it has buttons that are automatically laid out.

A Dialog should have one main element as child, that isn’t a button. The dialog can have any number of StandardButton widgets or other buttons with the dialog-button-role property. The buttons will be placed in an order that depends on the target platform at run-time.

The kind property of the StandardButtons and the dialog-button-role properties need to be set to a constant value, it can’t be an arbitrary variable expression. There can’t be several StandardButtons of the same kind.

A callback <kind>_clicked is automatically added for each StandardButton which doesn’t have an explicit callback handler, so it can be handled from the native code: For example if there is a button of kind cancel, a cancel_clicked callback will be added. Each of these automatically-generated callbacks is an alias for the clicked callback of the associated StandardButton.

icon

image default: the empty image

The window icon shown in the title bar or the task bar on window managers supporting it.

title

string default: ""

The window title that is shown in the title bar.