Dialog boxes in iced

Does iced have any support for (modal) dialog boxes?

If not, is it possible to have more than one “toplevel” window in iced. (What I meand by “toplevel” is as it is defined in Tk: A window whose parent is the root window of the X11 screen.)

For your use case, all you need is a stack with opaque, which respectively will let draw a stacked element (like a full sized container with an inner “dialog”-like container) and limit mouse interaction to that top level element

Check out the modal example:

For the sake of completeness, I should mention iced also has support for multi-window applications by using daemon, but I am not sure winit makes it easy (or even possible) for us to have proper modal windows today. That’s left as an exercise to some other, future reader.

I have a small crate that does most of the work for you: ~pml68/iced_dialog - sourcehut git

Actually, the modal example is NOT what I want. Here is a screenshot of what my current Tcl/Tk version can do:

From what I can tell, iced can’t really do this, at least not yet. Most of the other GUI toolkits probably can. Will iced eventually has the ability to do this?

You can always just create a separate window with this purpose in mind

Use daemon. There’s a multi_window example showcasing it.

I also once wrote an example that’s closer to what you want, with multiple window “types”

I can’t get this to compile:

marchhare% cargo run
   Compiling multi_window v0.1.0 (/home/heller/RustProjects/multi_window)
error[E0425]: cannot find function `every` in module `time`dow(bin)           
   --> src/main.rs:161:19
    |
161 | ...   time::every(Duration::from_millis(200)).map(|_| Message::Tick),
    |             ^^^^^ not found in `time`

For more information about this error, try `rustc --explain E0425`.
error: could not compile `multi_window` (bin "multi_window") due to 1 previous error

You probably grabbed the example from the master branch, but are trying to use it with 0.13 or vice versa. Switch to the 0.13 branch and get the code from there.

This is Airstrike’s code, which is separate from the iced example. The ided multi_window example does compile.

enable the tokio feature.

I’ve made a one-line edit to the gist to have it compile on the latest master