Auto-focus text_input in websocket example
This commit is contained in:
parent
15057a05c1
commit
4c658c41e9
1 changed files with 7 additions and 2 deletions
|
|
@ -1,7 +1,9 @@
|
||||||
mod echo;
|
mod echo;
|
||||||
|
|
||||||
use iced::alignment::{self, Alignment};
|
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 iced::{color, Command, Element, Length, Subscription};
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
|
|
||||||
|
|
@ -29,7 +31,10 @@ enum Message {
|
||||||
|
|
||||||
impl WebSocket {
|
impl WebSocket {
|
||||||
fn load() -> Command<Message> {
|
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> {
|
fn update(&mut self, message: Message) -> Command<Message> {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue