Create a window handle for a .slint file; nothing opens until
Window.show.
Path relative to the package directory, with / on every
system, for example "ui/picture.slint". It must stay inside the
package.
Optionaloptions: { id?: string }
id: the window's name, unique among this plugin's
windows until the window is disposed. Default: the file name without
its extension (ui/picture.slint → picture). Give distinct ids to
open the same file more than once.
A Window owned by this scope.
The file must export exactly one component, usually
export component Name inherits Window; helper components without
export are allowed. The window's properties and callbacks are declared
on that component. The file is not read here: a missing or broken file
makes Window.show reject.
Bind every callback with View.on before the first show().
Two compare windows open side by side, one labelled A and one B. A
window's id defaults to its file name, so the second window of the
same file needs its own id; each handle has its own properties.
const left = plugin.windows.create("ui/compare.slint", { id: "compare-left" });
const right = plugin.windows.create("ui/compare.slint", { id: "compare-right" });
left.set({ side: "A" });
right.set({ side: "B" });
await Promise.all([left.show(), right.show()]);
Create tool windows: separate windows drawn from the plugin's
.slintfiles.plugin.windows.Remarks
Use a tool window for something the user opens, works with and closes: a picture adjustment panel, an inspector, an editor. For content that should stay inside the player's main window, mount a panel; for preferences, add a settings page; for a yes/no question, use Dialogs.confirm. A plugin can have any number of windows.
Example: Create a window and open it from a menu (examples/bookmark)
A Bookmark window opens from Playback ▸ Bookmark….
createreturns a handle without opening anything; its bindings and callbacks are set up first, andshowopens the window when the command runs.See
Window, Open a tool window and remember its state
Since
1.0.0