summaryrefslogtreecommitdiffstats
path: root/examples/pane_grid
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-09-10 00:34:21 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-09-10 00:34:21 +0200
commitb8e5693a3089d728b4f8d4b3b0b7197202ebd732 (patch)
tree79a9f84f9920525657fbe03d53ce33bab09053d7 /examples/pane_grid
parent956512338905bac0b156fdaf16fe3c3e07e97a84 (diff)
parenta3489e4af960388e9f73988b88df361022a654a4 (diff)
downloadiced-b8e5693a3089d728b4f8d4b3b0b7197202ebd732.tar.gz
iced-b8e5693a3089d728b4f8d4b3b0b7197202ebd732.tar.bz2
iced-b8e5693a3089d728b4f8d4b3b0b7197202ebd732.zip
Merge branch 'master' into explicit-text-caching
Diffstat (limited to 'examples/pane_grid')
-rw-r--r--examples/pane_grid/Cargo.toml3
-rw-r--r--examples/pane_grid/README.md4
-rw-r--r--examples/pane_grid/src/main.rs14
3 files changed, 6 insertions, 15 deletions
diff --git a/examples/pane_grid/Cargo.toml b/examples/pane_grid/Cargo.toml
index 4c0bf072..095ecd10 100644
--- a/examples/pane_grid/Cargo.toml
+++ b/examples/pane_grid/Cargo.toml
@@ -6,4 +6,5 @@ edition = "2021"
publish = false
[dependencies]
-iced = { path = "../..", features = ["debug", "lazy"] }
+iced.workspace = true
+iced.features = ["debug", "lazy"]
diff --git a/examples/pane_grid/README.md b/examples/pane_grid/README.md
index a4cfcb7d..65357b23 100644
--- a/examples/pane_grid/README.md
+++ b/examples/pane_grid/README.md
@@ -15,9 +15,7 @@ This example showcases the `PaneGrid` widget, which features:
The __[`main`]__ file contains all the code of the example.
<div align="center">
- <a href="https://gfycat.com/frailfreshairedaleterrier">
- <img src="https://thumbs.gfycat.com/FrailFreshAiredaleterrier-small.gif">
- </a>
+ <img src="https://iced.rs/examples/pane_grid.gif">
</div>
You can run it with `cargo run`:
diff --git a/examples/pane_grid/src/main.rs b/examples/pane_grid/src/main.rs
index 04896e20..af87e2c0 100644
--- a/examples/pane_grid/src/main.rs
+++ b/examples/pane_grid/src/main.rs
@@ -1,8 +1,6 @@
use iced::alignment::{self, Alignment};
-use iced::event::{self, Event};
use iced::executor;
use iced::keyboard;
-use iced::subscription;
use iced::theme::{self, Theme};
use iced::widget::pane_grid::{self, PaneGrid};
use iced::widget::{
@@ -146,18 +144,12 @@ impl Application for Example {
}
fn subscription(&self) -> Subscription<Message> {
- subscription::events_with(|event, status| {
- if let event::Status::Captured = status {
+ keyboard::on_key_press(|key_code, modifiers| {
+ if !modifiers.command() {
return None;
}
- match event {
- Event::Keyboard(keyboard::Event::KeyPressed {
- modifiers,
- key_code,
- }) if modifiers.command() => handle_hotkey(key_code),
- _ => None,
- }
+ handle_hotkey(key_code)
})
}