Function fltk::app::repeat_timeout3

source ·
pub fn repeat_timeout3(tm: f64, handle: TimeoutHandle)
Expand description

Repeats the timeout callback, associated with the hadle, from the expiration of the previous timeout. You may only call this method inside a timeout callback. The timeout duration tm is indicated in seconds Example:

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

    let app = app::App::default();
    let mut wind = window::Window::new(100, 100, 400, 300, "");
    wind.show();
    app::add_timeout3(1.0, callback);
    app.run().unwrap();
}
Examples found in repository?
examples/animations.rs (line 52)
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);
    }
}