import { Button, VerticalBox } from "std-widgets.slint"; export global Globals { //启动按钮状态 in-out property StartEnable: false; //停止按钮状态 in-out property StopEnable: false; } export component MainWindow inherits Window { title: "VoileTftpTools"; icon: @image-url("../tftp.png"); height: 180px; width: 320px; default-font-family: "Segoe UI"; default-font-size: 16px; default-font-weight: 700; in-out property StartEnable <=> Globals.StartEnable; in-out property StopEnable <=> Globals.StopEnable; //选择路径回调 callback BrowserFolder() -> string; property SelectFolder: ""; //启动回调 callback StartTftp(); //停止回调 callback StopTftp(); //选择路径按钮 Rectangle { height: 35px; width: 95px; x: 10px; y: 10px; Button { height: parent.height; width: parent.width; text: "选择路径"; clicked => { SelectFolder = BrowserFolder(); } } } Rectangle { height: 35px; width: 95px; x: 110px; y: 10px; Button { height: parent.height; width: parent.width; text: "启动"; enabled: StartEnable; clicked => { StartTftp(); } } } Rectangle { height: 35px; width: 95px; x: 210px; y: 10px; Button { height: parent.height; width: parent.width; text: "停止"; enabled: StopEnable; clicked => { StopTftp(); } } } Text { x: 13px; y: 55px; text: "路径:"; } Text { x: 60px; y: 55px; width: 200px; wrap: word-wrap; // 自动换行关键属性 text: SelectFolder; } }