From 1448c5bfa5d0977e54670bb8c640ba186bb13167 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 18 Sep 2024 20:30:14 +0200 Subject: Implement some `From` traits for `text_input::Id` --- examples/multi_window/src/main.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'examples/multi_window/src') diff --git a/examples/multi_window/src/main.rs b/examples/multi_window/src/main.rs index ab09116e..b43a627a 100644 --- a/examples/multi_window/src/main.rs +++ b/examples/multi_window/src/main.rs @@ -25,7 +25,6 @@ struct Window { scale_input: String, current_scale: f64, theme: Theme, - input_id: iced::widget::text_input::Id, } #[derive(Debug, Clone)] @@ -86,7 +85,7 @@ impl Example { } Message::WindowOpened(id) => { let window = Window::new(self.windows.len() + 1); - let focus_input = text_input::focus(window.input_id.clone()); + let focus_input = text_input::focus(format!("input-{id}")); self.windows.insert(id, window); @@ -163,7 +162,6 @@ impl Window { scale_input: "1.0".to_string(), current_scale: 1.0, theme: Theme::ALL[count % Theme::ALL.len()].clone(), - input_id: text_input::Id::unique(), } } @@ -182,7 +180,7 @@ impl Window { text("Window title:"), text_input("Window Title", &self.title) .on_input(move |msg| { Message::TitleChanged(id, msg) }) - .id(self.input_id.clone()) + .id(format!("input-{id}")) ]; let new_window_button = -- cgit