How to access main window ID?

In Iced 12, the main window was easily accessible using window::Id::MAIN. However, with Iced 13, how can I access the main window’s ID now?

You can get the window id using get_oldest in iced::window - Rust.

1 Like

But if the main window is not the first lauched neither the last? I can i set a custom ID or access Main window’s one?

You have to use a match statement to perform task depending on the kind of window returned.
windows.get(&id) will return Option<Window>, then you can match it get the window. (Note: Window depends on how you’ve implemented)

one simple straightforward example could be found in Capter repo.

1 Like