Rust语言
这里演示了使用handle函数捕获“E”和向下键。
use fltk::{prelude::*,*, window::Window, app::event_key};
fn main() {
let app = app::App::default().with_scheme(app::Scheme::Gleam);
let mut wind = Window::default().with_size(100, 100);
let mut frame = frame::Frame::default();
frame.handle(move |_, event |match event {
enums::Event::KeyUp => {
if app::event_key() == enums::Key::from_char('e'){
println!("E Up");
}
if app::event_key() == enums::Key::Down{
println!("Down Up");
}
true
}
_ => false
});
wind.end();
wind.show();
app.run().unwrap();
}
标签:key,fltk,rs,app,let,frame,按键,event
From: https://www.cnblogs.com/MisakaE/p/17834870.html