summaryrefslogtreecommitdiffstats
path: root/examples/websocket
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-05-03 09:25:47 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-05-03 09:25:47 +0200
commit4c658c41e9e5bf2c0c963ef49c1830257781b16e (patch)
treeea1d229fda688008bd31c285b2dfe5e444983efc /examples/websocket
parent15057a05c118dafcb8cf90d4119e66caaa6026c5 (diff)
downloadiced-4c658c41e9e5bf2c0c963ef49c1830257781b16e.tar.gz
iced-4c658c41e9e5bf2c0c963ef49c1830257781b16e.tar.bz2
iced-4c658c41e9e5bf2c0c963ef49c1830257781b16e.zip
Auto-focus `text_input` in `websocket` example
Diffstat (limited to 'examples/websocket')
-rw-r--r--examples/websocket/src/main.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/examples/websocket/src/main.rs b/examples/websocket/src/main.rs
index e7ececf7..ba1e1029 100644
--- a/examples/websocket/src/main.rs
+++ b/examples/websocket/src/main.rs
@@ -1,7 +1,9 @@
mod echo;
use iced::alignment::{self, Alignment};
-use iced::widget::{button, center, column, row, scrollable, text, text_input};
+use iced::widget::{
+ self, button, center, column, row, scrollable, text, text_input,
+};
use iced::{color, Command, Element, Length, Subscription};
use once_cell::sync::Lazy;
@@ -29,7 +31,10 @@ enum Message {
impl WebSocket {
fn load() -> Command<Message> {
- Command::perform(echo::server::run(), |_| Message::Server)
+ Command::batch([
+ Command::perform(echo::server::run(), |_| Message::Server),
+ widget::focus_next(),
+ ])
}
fn update(&mut self, message: Message) -> Command<Message> {