summaryrefslogtreecommitdiffstats
path: root/examples/todos
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-08-04 03:24:44 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-08-04 03:24:44 +0200
commit6eb3dd7e5edc8847875c288c41d1dec8b1dad06e (patch)
treed4b8ff42a57d520e90fe8d854d83cc3a9377e06f /examples/todos
parent54ad92ce913629d1d1f623f4b14d51244554a59c (diff)
downloadiced-6eb3dd7e5edc8847875c288c41d1dec8b1dad06e.tar.gz
iced-6eb3dd7e5edc8847875c288c41d1dec8b1dad06e.tar.bz2
iced-6eb3dd7e5edc8847875c288c41d1dec8b1dad06e.zip
Implement `focus_previous` operation
Diffstat (limited to 'examples/todos')
-rw-r--r--examples/todos/src/main.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/examples/todos/src/main.rs b/examples/todos/src/main.rs
index 25d90a0b..bb00aac6 100644
--- a/examples/todos/src/main.rs
+++ b/examples/todos/src/main.rs
@@ -51,7 +51,7 @@ enum Message {
CreateTask,
FilterChanged(Filter),
TaskMessage(usize, TaskMessage),
- TabPressed,
+ TabPressed { shift: bool },
}
impl Application for Todos {
@@ -147,7 +147,13 @@ impl Application for Todos {
Command::none()
}
- Message::TabPressed => widget::focus_next(),
+ Message::TabPressed { shift } => {
+ if shift {
+ widget::focus_previous()
+ } else {
+ widget::focus_next()
+ }
+ }
_ => Command::none(),
};
@@ -251,10 +257,13 @@ impl Application for Todos {
(
Event::Keyboard(keyboard::Event::KeyPressed {
key_code: keyboard::KeyCode::Tab,
+ modifiers,
..
}),
event::Status::Ignored,
- ) => Some(Message::TabPressed),
+ ) => Some(Message::TabPressed {
+ shift: modifiers.shift(),
+ }),
_ => None,
})
}