struct Date
¶
Defines a date with day, month, and year
Fields¶
day
(int): The day value (range from 1 to 31).month
(int): The month value (range from 1 to 12).year
(int): The year value.
DatePicker
¶
Use a date picker to let the user select a date.
Properties¶
title
(in string): The text that is displayed at the top of the picker.cancel-label
(in string): The text written in the cancel button.ok-label
(in string): The text written in the ok button.date
: (in Date): Set the initial displayed date.input-title
: (in string): Title that displayed on the date inputLineEdit
.input-placeholder
: (in string): Placeholder text that is displayed on the date inputLineEdit
.input-format
: (in string): Defines the format that is used to parse the text ofLineEdit
. For more details check the https://docs.rs/chrono/latest/chrono/format/strftime/index.html. (default"%m/%d/%Y"
)
Callbacks¶
canceled()
: The cancel button was clicked.accepted(Date)
The ok button was clicked.
Example¶
import { DatePicker, Button } from "std-widgets.slint";
export component Example inherits Window {
width: 600px;
height: 600px;
date-picker-button := Button {
text: @tr("Open Date Picker");
clicked => {
date-picker.show();
}
}
date-picker := PopupWindow {
width: 360px;
height: 524px;
close-on-click: false;
DatePicker {
canceled => {
date-picker.close();
}
accepted(date) => {
debug(date);
date-picker.close();
}
}
}
}