Function fltk::app::remove_timeout3

source ·
pub fn remove_timeout3(handle: TimeoutHandle)
Expand description

Removes the timeout callback associated with the handle

use fltk::{prelude::*, *};
fn main() {
    let callback = |handle| {
        println!("FIRED");
    };

    let app = app::App::default();
    let mut wind = window::Window::new(100, 100, 400, 300, "");
    wind.show();
    let handle = app::add_timeout3(1.0, callback);
    app::remove_timeout3(handle);
    app.run().unwrap();
}
Examples found in repository?
examples/animations.rs (line 50)
45
46
47
48
49
50
51
52
53
54
fn move_image(mut frm: Frame, handle: app::TimeoutHandle) {
    let (x, y) = (frm.x(), frm.y());
    frm.set_pos(x + 5, y);
    app::redraw();
    if frm.x() > 260 {
        app::remove_timeout3(handle)
    } else {
        app::repeat_timeout3(0.016, handle);
    }
}